jmb-d
6/17/2007 1:06:00 AM
Is it possible to redefine (temporarily) the meaning of \b in RegExp
situations?
Here's the scenario: I've got some data that looks something like,
"ABCD.E", which I stuff into an array as I encounter each new
instance. Eventually, I will join(", ") these together having
surrounded each of them with single quotes, for use in an SQL "IN
(...)" clause.
At first, I tried doing this with gsub(/\b/, "'"), but found out the
hard way that the period was wreaking havoc with my intended results,
and I got this: 'ABCD'.'E' instead.
My next attempt was to do it by hand, like this: gsub(/^/, "'").gsub(/
$/, "'"). This worked, but seems a bit like a hack.
So my question is whether there's any way to temporarily declare that
a period is NOT to be considered a word boundary.
Thanks, in advance,
jmb-d