Group: Difference between revisions
Jump to navigation
Jump to search
imported>Bale No edit summary |
imported>Ulti improving navigation |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 32: | Line 31: | ||
needscode=yes| | needscode=yes| | ||
see_also={{SeeAlso|group_count|find}}| | see_also={{SeeAlso|create_matcher|group_count|find|group_string}}| | ||
}} | }} | ||
[[Category:String Handling Routines]] |
Latest revision as of 17:04, 14 October 2014
needs(code_samples);
Function Syntax
string group(matcher pattern )
- pattern is the regular expression to use
string group(matcher pattern ,int group )
- pattern is the regular expression to use
- group is the number of the capturing group to return
Returns the contents of an indicated capturing group or the entire pattern if not indicated. If the match was successful but the group specified failed to match any part of the input sequence, then the null string is returned. A group may match an empty string, so remember the null string is "\u0000".
Capturing groups are indexed from left to right, starting at one. Group zero indicates the entire pattern so group(m,0) is equivalent to group(m).