Problem 1: Not many online/offline Regexp testing/debugging tools support Ruby Regexp syntax. But at the same time it's not very convenient to test Regexes right in your code or in the
pry (they are not interactive enough). Luckily we have Rubular, but…
Problem 2: Try to open Rubular and paste
sample_data.txt content as a test string and
regex.txt content as a regular expression. After matching highlight process is done (yeah, you have to be patient enough to see that) try to edit anything in Regexp…
Problem 3: Rubular currently supports Ruby 1.8.7 / 1.9.3 and 2.1.5, but it would be great to test your Regexes in your current Ruby version (just in case, to be 100% sure)
Problem 4: Sometimes highlighting ins't enough (because of a huge amount of the test data) it would be great to know exact count of occurrences.
This approach tastes better within
vim, but you could just place your GUI editor/IDE window side by side with the terminal.
$ watch -n1 -c ~/regex.sh ~/sample_data.txt $ vim ~/regex.sh # or ~/regex.txt # # * Edit REGEX ENV variable export in the file or regex.txt content # * (un)Comment lines in MODES section to affect the output # * Use inline flags to ignore case and so on # * If you have a complex regex use regex.txt file with (?x:<pattern>)
Check the demo!