Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Splitting multiple commands with regex failure

by 2teez (Priest)
on Aug 24, 2012 at 07:43 UTC ( #989440=note: print w/ replies, xml ) Need Help??


in reply to Splitting multiple commands with regex failure

Hi,

To start with check this line:

if $command ne "") { ## Oops ... ### should be if ($command ne "") { ...
..(It parses the first parameters, like "command=!book this is my test book !number 1222223 !book another book" will just split out "!book this is my test book", and ignore the rest.

If you want just !book this is my test book, then you might have to check your regex again!!!
Beacuse this: m/(!\w+\s?.+?)(?=!\w)/simg; was just doing it job. Really.

Please also check this: # (!\w+\s?)(.+?(?=!\w)) is the original regex I was using
That was no where in your code as indicated in the original post. so this print "Command 3 is $3\n\n"; will cry foul!!! As this m/(!\w+\s?.+?)(?=!\w)/simg; is not equal to m/(!\w+\s?)(.+?(?=!\w))/;
Knowing that your data is unknown.


Comment on Re: Splitting multiple commands with regex failure
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2014-12-29 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (194 votes), past polls