iaw4 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Defining Characters in Word Boundary?
by ikegami (Patriarch) on Jan 19, 2011 at 22:47 UTC | |
by Jim (Curate) on Jan 20, 2011 at 01:30 UTC | |
by iaw4 (Monk) on Jan 20, 2011 at 14:00 UTC | |
by ikegami (Patriarch) on Jan 20, 2011 at 16:32 UTC | |
by Jim (Curate) on Jan 20, 2011 at 17:17 UTC | |
by AnomalousMonk (Archbishop) on Jan 20, 2011 at 23:28 UTC | |
by Jim (Curate) on Jan 21, 2011 at 01:06 UTC | |
| |
by Anonymous Monk on Jan 20, 2011 at 18:08 UTC | |
by Jim (Curate) on Jan 20, 2011 at 19:40 UTC | |
| |
|
Re: Defining Characters in Word Boundary?
by Jim (Curate) on Jan 20, 2011 at 01:16 UTC | |
|
Re: Defining Characters in Word Boundary?
by luis.roca (Deacon) on Jan 19, 2011 at 22:59 UTC | |
by ikegami (Patriarch) on Jan 19, 2011 at 23:17 UTC | |
by luis.roca (Deacon) on Jan 19, 2011 at 23:39 UTC | |
by ikegami (Patriarch) on Jan 21, 2011 at 01:42 UTC | |
by luis.roca (Deacon) on Jan 21, 2011 at 04:45 UTC | |
by ikegami (Patriarch) on Jan 21, 2011 at 07:12 UTC |