Matching S01E01 in Ruby
with
/S\d+?E\d+?/ix
which works, however, S01 E01 does not. I thought the /x should ignore white spaces?
The x option ignores whitespace in the regex itself, which allows you to better format your regexes for reading without modifying their meaning. You could write:
irb(main):008:0> r = /
irb(main):009:0/ S
irb(main):010:0/ d+?
irb(main):011:0/ E
irb(main):012:0/ d+?
irb(main):013:0/ /ix
To get an regex with the same meaning as your example.