Syntactic Confectionery Delight | |
PerlMonks |
Defining Characters in Word Boundary?by iaw4 (Monk) |
on Jan 19, 2011 at 22:44 UTC ( [id://883217]=perlquestion: print w/replies, xml ) | Need Help?? |
iaw4 has asked for the wisdom of the Perl Monks concerning the following question:
Dear perl monks---
is it possible to define the characters that '\b' matches? I am processing latex code, and their macro character space is \ a-zA-Z \. I would like to write \\$keyword\b where $keyword may hold, say, "Chi". The problem is that if my latex code says "\\Chi_2", perl thinks that the '_' is a word character. same problem for "\\sqrt22". Alternatively, is there a way to have a "zero width" match like boundary? It would be tedious to have to write \\$keyword([^a-zA-Z]) and then have to substitute back $1 (because I do not want it eaten). advice appreciated. /iaw
Back to
Seekers of Perl Wisdom
|
|