R
Ruby Baby
Sorry it seems like the smallest thing, but I'm stuck on this.
I'm trying to make a simple regex to strip away characters that are NOT certain characters I name.
I'm unclear on what Ruby uses as a "NOT" match in regex, like ! is for !=
(Or if it uses the ^, where does it put it?)
EXAMPLE:
myString = 'I want only the letters a and t and period. When done it should look like atttaatta.tatttaatta..'
# this doesn't work of course:
puts myString.gsub(!/at\./, '')
Can someone show me where to find the rule on this?
I couldn't find it in any documentation, or Ruby Way or Programming Ruby books.
Thanks!
I'm trying to make a simple regex to strip away characters that are NOT certain characters I name.
I'm unclear on what Ruby uses as a "NOT" match in regex, like ! is for !=
(Or if it uses the ^, where does it put it?)
EXAMPLE:
myString = 'I want only the letters a and t and period. When done it should look like atttaatta.tatttaatta..'
# this doesn't work of course:
puts myString.gsub(!/at\./, '')
Can someone show me where to find the rule on this?
I couldn't find it in any documentation, or Ruby Way or Programming Ruby books.
Thanks!