I’m trying to match the word “first_name” from the below snippet:
<div class="field">
<%= f.label :first_name %><br />
<%= f.text_field :first_name %>
</div>
Using something like this regular expression:
<div class="field">((\n|.)*?)<\/div>
gives me:
<%= f.label :first_name %><br />
<%= f.text_field :first_name %>
(Here is the expression in action: http://rubular.com/r/uh6SZ6EGcQ)
Since I only want “first_name”, what regular expression should I use such that I can match only the “first_name”?
You could simply use the regex
To match symbols.