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

match

(This command has been awarded a Yubnub Golden Egg)

http://jonathanaquino.com/singpolymaplay/yubnub-match.php?xn_auth=no&string=%s&pattern=${pattern}&nbrmatches=${nbrmatches}&matchnbr=${matchnbr}&capture=${capture}&as=${as}&callback=${callback}&url=${url}
NAME
     match - Run a RegExp pattern against a string

SYNOPSIS
     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]

EXAMPLES
     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


NOTES
     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

AUTHOR
     Stephen Paul Weber
     http://singpolyma-tech.blogspot.com/
    
5706005 uses - Created 2006-04-26 07:40:22 - Last used 2024-04-15 04:53:39
Is this command broken? Tell Jon if you know how to fix it.