Prototype: regcmp(regex, string)

Return type: boolean

Description: Returns whether the anchored regular expression regex matches the string.


  • regex: regular expression, in the range: .*
  • string: string, in the range: .*


body common control
      bundlesequence => { subtest("mark") };

bundle agent subtest(user)

      "invalid" not => regcmp("[a-z]{4}","$(user)");



      "User name $(user) is valid at exactly 4 letters";


      "User name $(user) is invalid";


R: User name mark is valid at exactly 4 letters

If the string contains multiple lines, then it is necessary to code these explicitly, as regular expressions do not normally match the end of line as a regular character (they only match end of string). You can do this using either standard regular expression syntax or using the additional features of PCRE (where (?ms) changes the way that ., ^ and $ behave), e.g.

See also: regline(), strcmp()