Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Regexp. Combination of words block. Need help.

by Anonymous Monk
on Feb 09, 2020 at 10:48 UTC ( [id://11112673]=note: print w/replies, xml ) Need Help??


in reply to Regex. Combination of words block. Need help.

Why that array? Id use split
  • Comment on Re: Regexp. Combination of words block. Need help.

Replies are listed 'Best First'.
Re^2: Regexp. Combination of words block. Need help.
by nickwest (Initiate) on Feb 09, 2020 at 11:23 UTC
    $b = 'aaa,bbb,ccc ddd; eee fff, kv.6 end'; @a = split(/[\s\,\.\;]+/, $b); for ($i=0;$i<$#a-1;$i++) { $_ = $b; $k = $a[$i]; s/^.*$k[\s\,\.\;]+//; push @c, $_; } push @a, @c, $b; foreach (@a) { print "$_\n"; }

    and get:
    aaa bbb ccc ddd eee fff kv 6 end bbb,ccc ddd; eee fff, kv.6 end ccc ddd; eee fff, kv.6 end ddd; eee fff, kv.6 end eee fff, kv.6 end fff, kv.6 end kv.6 end 6 end aaa,bbb,ccc ddd; eee fff, kv.6 end
Re^2: Regexp. Combination of words block. Need help.
by nickwest (Initiate) on Feb 09, 2020 at 11:30 UTC
    Yes! Thank you! I'm going by your way. Firstly split! But I think it's possible make by one regex.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found