Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Complex regex question

by beech (Parson)
on Sep 25, 2019 at 06:45 UTC ( #11106667=note: print w/replies, xml ) Need Help??


in reply to Complex regex question

Hi

words boundaries?

$string_three =~ m{\b ( [ab] \d+ | \d+ [ab] ) \b }gx

what are the undefs in my @results?

List context for match groups

Replies are listed 'Best First'.
Re^2: Complex regex question
by AnomalousMonk (Bishop) on Sep 25, 2019 at 06:58 UTC

    But Cody Fendant seems to want the alpha and numeric fields extracted separately. The  m{\b ( [ab] \d+ | \d+ [ab] ) \b }gx regex requires a subsequent (albeit simple) step to achieve this:

    c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $string_three = 'foo bar [21a] plus (b23) baz bax'; my @string_three_results = $string_three =~ m{\b ( [ab] \d+ | \d+ [ab +] ) \b }gx; dd \@string_three_results; " ["21a", "b23"]


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106667]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2021-04-11 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?