Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

_ _

Creating Regular Expressions

...

A digit is easy, that's "\d", so a number is "\d+", where the "+" means one or more of the previous item.



Wiki Markup
A hex character can be represented by "\[0-9A-Za-z\]". The enclosing "\[\]" create a _character class_ which matches one of the specified characters. The "-" here means a range.



So putting that together, we get:

No Format

input type="hidden" name="secret" value="([0-9A-Za-z]+\.\d+)\(d\)"

Now suppose we wanted to match the whole of the value. We could move the closing capture parenthesis to the end of the value. This would be suitable if there were other values with different patterns that we did not want to match.

However, if we just wanted to capture the quoted value, then we could use:

No Format

input type="hidden" name="secret" value="([^"]+)"



Wiki Markup
The character class in this case is _\[^"\]_ which means any character except double-quote. The "+" suffix means we want as many as there are in succession. This will take us up to the end of the value.



Hints and tips

If the expression matches more than once in the source, you have a choice:

...