Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.


(This command has been awarded a Yubnub Golden Egg)

     match - Run a RegExp pattern against a string

     match [STRING] [-url [URL FOR PAGE TO USE AS STRING]] -pattern [REGEXP PATTERN] -nbrmatches [RETURN NUMBER OF MATCHES?] -matchnbr [RETURN MATCH AT] -capture [CAPTURE?] -as [AS] -callback [CALLBACK]

     match <div>hello</div>blah -pattern /<div>.*?<\/div>/
        returns an XML-style 'array' with one element, '<div>hello</div>'
     match <div>hello</div>blah<div>hi</div> -pattern /<div>.*?<\/div>/
        returns an XML-style 'array' with two elements, '<div>hello</div>' and '<div>hi</div>'
     match <div>hello</div>blah -pattern /<div>.*?<\/div>/ -as xoxo
        returns an XOXO-style 'array' with one element, '<div>hello</div>'
     match <div>hello</div>blah -pattern /<div>.*?<\/div>/ -as json [-callback x]
        returns a JSON-style 'array' with one element, '<div>hello</div>'
        (using optional JSONP callback of x)
     match <div>hello</div>blah -pattern /<div>.*?<\/div>/ -nbrmatches 1
        returns 1 (the number of matches)
     match <div>hello</div>blah -pattern /<div>.*?<\/div>/ -matchnbr 1
        returns <div>hello</div> (the first match)
     match <div>hello</div>blah -pattern /<div>(.*)?<\/div>/ -capture 1
        returns an XML-style 'array' with one element, 'hello' (the captured item)

     match -url http://yubnub.org/kernel/man?args=match -pattern /<pre>[^\f]*?<\/pre>/
        returns an XML-style 'array' with one element, the text from this man page

     If you use capture parenthesis in your pattern you must pass -capture 1 to get
     the captured data.
     The RegExp pattern must be enclosed in the appropriate // and be RegExp-safe
     (ie and / or \ escaped out at \/ or \\)
     For a more boolean RegExp function see ifMatch

     Stephen Paul Weber
5705940 uses - Created 2006-04-26 07:40:22 - Last used 2016-12-31 07:18:02