Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Anonymous Monk
on Feb 09, 2020 at 10:48 UTC ( #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
Node Status?
node history
Node Type: note [id://11112673]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2020-03-29 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (169 votes). Check out past polls.

    Notices?