I am trying to help the readability in my terminal and thought I'd create a trigger highlight for when I use binding.pry
.
The regex I used to match any <% binding.pry %>
is:
(?i:.*<% binding.pry %>.*)
This works great, but wanted to take it one step further and only highlight the current binding.pry in the terminal (in case I may have multiples that display in the terminal).
How might I write my ICU regex so the following outputs correctly:
64: <div class="form-group">
=> 65: <% binding.pry %> # This one should match
66: </div>
67: <% binding.pry %> # This one should not be matched
I know I want to match a string that includes the =>
as well as the <% binding.pry %>
but negate the whitespace and numbers. The closest approach I thought would work was (?:\S+[^0-9].*=><% binding.pry %>)
but this unfortunately did not work.
Unless I understood your last paragraph incorrectly,
(?m:^ => \d+:\s*<% binding.pry %>.*)
should do what you want.It only matches the
=> 65: <% binding.pry %> # This one should match
line.See it in action here