Regex: \<start-of-word, and end-of-word\> not in gsub?

I often use < and > to denote the start and end of word. But they
don’t seem to work with gsub. Am I missing something?

I would expect the following:
“xword1 word2 tword3”.gsub( /<word, ‘XXXX’ )

to return “xword1 XXXX2 tword3”, but instead it the string unchanged.

If the < and > are not supported, is there an alternative that ruby
provides? Thanks.

Thanks,

~S

Shea M. wrote:

I often use < and > to denote the start and end of word. But they
don’t seem to work with gsub. Am I missing something?

I would expect the following:
“xword1 word2 tword3”.gsub( /<word, ‘XXXX’ )

to return “xword1 XXXX2 tword3”, but instead it the string unchanged.

If the < and > are not supported, is there an alternative that ruby
provides? Thanks.

Thanks,

~S

“xword1 word2 tword3”.gsub( /\bword/, ‘XXXX’ )

$rm rm