Your skill will accomplish what the force of many cannot |
|
PerlMonks |
regex, pos, \G, and substrby ff (Hermit) |
on Jun 03, 2007 at 01:53 UTC ( [id://618946]=perlquestion: print w/replies, xml ) | Need Help?? |
ff has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks My users create strings which contain text like update 8923 mark complete. I'd like to allow them to create strings like update 8435 and 9323 mark complete and convert those into multiple strings that look like the old pattern, i.e. update 8435 mark complete update 9323 mark complete. The following snippet does just what I want, but the Camel Book, in describing the \G assertion, says Whenever you start thinking in terms of the pos function, it's tempting to start carving your string up with substr, but this is rarely the right thing to do. So, should I consider doing something else? Thanks.
Back to
Seekers of Perl Wisdom
|
|