Match () with regex () (): Difference between revisions
Content deleted Content added
Ninja 6734 (talk | contribs) added page |
mNo edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1:
{{Infobox Block|block_name=match [foo bar] with regex [foo] [g]::operators reporter|block_type=Reporter Block|category=[[Operators]]}}
The match regex block is a reporter block that matches a string with a [
▲The match regex block is a reporter block that matches a string with a [https://en.wikipedia.org/wiki/Regular_expression regular expression], a regex.
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
<scratchblocks>
(match [foo bar] with regex [foo] [g] :: operators) // ["foo"]
</scratchblocks>
In this example inputs of the block it searches for the string "foo" in the string "foo bar" which will result in the array ["foo"] since there is only one foo in the string.
<scratchblocks>
(match [banana orange apple banana banana pear apple] with regex [banana] [g] :: operators) // ["banana","banana","banana"]
</scratchblocks>
For this example the block searches for every occurance of the word "banana" which results in the array ["banana","banana","banana"].
== See Also ==
* [[Regular expressions]]
{{Blockcat|type=Reporter|cat=Operators}}
|