DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(m4.info) Regexp

Info Catalog (m4.info) Index (m4.info) Text handling (m4.info) Substr
 
 Searching for regular expressions
 =================================
 
    Searching for regular expressions is done with the builtin `regexp':
 
      regexp(STRING, REGEXP, opt REPLACEMENT)
 
 which searches for REGEXP in STRING.  The syntax for regular
 expressions is the same as in GNU Emacs.   Syntax of Regular
 Expressions (emacs)Regexps.
 
    If REPLACEMENT is omitted, `regexp' expands to the index of the
 first match of REGEXP in STRING.  If REGEXP does not match anywhere in
 STRING, it expands to -1.
 
      regexp(`GNUs not Unix', `\<[a-z]\w+')
      =>5
      regexp(`GNUs not Unix', `\<Q\w*')
      =>-1
 
    If REPLACEMENT is supplied, `regexp' changes the expansion to this
 argument, with `\N' substituted by the text matched by the Nth
 parenthesized sub-expression of REGEXP, `\&' being the text the entire
 regular expression matched.
 
      regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***')
      =>*** Unix *** nix ***
 
    The builtin macro `regexp' is recognized only when given arguments.
 
Info Catalog (m4.info) Index (m4.info) Text handling (m4.info) Substr
automatically generated byinfo2html