Regex Samples: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
Created page with "{{TOCright}} == Regex Samples == Always be precise in the way you specify your data. {| class="wikitableharmcenter" width="850" |- | [[File:Regex-21-001.png|thumb|center|750p..."
 
Line 2: Line 2:


== Regex Samples ==
== Regex Samples ==
Always be precise in the way you specify your data.
Always be precise in the way you specify your data. The following question can be multiple interpreted.
<br>Create a regular expression that matches the figures:
* 1 - 49
* 01 - 49
Of course the '''<nowiki>^[0-4]?[0-9]</nowiki>''' is much too simple.
{| class="wikitableharmcenter" width="850"
{| class="wikitableharmcenter" width="850"
|-
|-
Line 12: Line 17:
|-
|-
| [[File:Regex-21-004.png|thumb|center|750px| Matches all correctly]]
| [[File:Regex-21-004.png|thumb|center|750px| Matches all correctly]]


== See also ==
== See also ==

Revision as of 10:54, 17 February 2015

Regex Samples

Always be precise in the way you specify your data. The following question can be multiple interpreted.
Create a regular expression that matches the figures:

  • 1 - 49
  • 01 - 49

Of course the ^[0-4]?[0-9] is much too simple.

Matches correctly but recognize 11 first as 1 and 1
Matches correctly but recognize 11 first as 1 and 1
Matches correctly but recognize 51 as 5 and 1
Matches all correctly

See also

top

Reference

top