Match () with regex () (): Difference between revisions

added flags
(finished the page)
(added flags)
Line 4:
 
=== Use ===
This block searches for every instance of the selected rule. The rule can be inserted into the second input box. The third input box acts as a ?flag (pleasemore addinfo whatlater this input box doeson)
 
=== Examples ===
Line 27:
|-
|.
|This is the syntax for (almost) any character (see flags)
|["gray grey griy gary"] ["gr'''.'''y"] ["g"] -> ["gray", "grey", "griy"]
|-
Line 134:
["I would like to find all \s in this very \-filled \text"] ["'''\\'''"] ["g"] -> ["\","\","\"]
|}
 
=== Flags ===
Flags are used to redefine the behaviour of a regular expression. These flags include:
{| class="wikitable"
|+Flags
!Flag
!Name
!Description
|-
|g
|Global
|Finds all the matching sub-strings not only the first one
|-
|i
|Case-insensitive
|Makes the rule case-insensitive. For example if the rule is [e] and the flag [ig] all e '''and''' E's get matched
|-
|m
|multi-line
|Changes the meaning of the rule $ and ^ to be the end and beginning of a line and whole string
|-
|s
|dotalls
|changes the . character to include '''every''' character including new-line
|}
To use multiple flags you write them, as seen in the description of the case-insensitive flag, after another with '''no delimiter''' (a space or comma inbetween the flags). Order does not matter.
 
More flags can be found [https://www.codeguage.com/courses/regexp/flags here]
 
== Comments ==
16

edits