in reply to Regex capture between word and punctuation
Conversely, =~ m#(it\s# would match all of those, whereas each of the replies above avoids that potential problem by requiring a wordboundry -- in this case, a space -- (#\bit\b# or # it # on both sides of any string, "it".
|
|---|