How to use positive lookahead for a specific word in apache regex -


how use positive lookahead specific word in apache regex.

example:

in java regex have following regex ^(?=.*\blocal\sservice\b).

what equivalent regex in apache regex? there positive lookahead in apache regex equivalent ?=

in short: apace uses pcre regex engine, 1 of full-featured engines out there. can use same lookahead used in java.

there slight differences, shouldn't matter pattern.

for reference: token-by-token comparison of pattern in java , pcre

  • assert position @ beginning of string ^
  • assert regex below can matched, starting @ position (positive lookahead) (?=.*\blocal\sservice\b)
    • java 8 interprets part differently .*
      • match single character not line break character (line feed, carriage return, next line, line separator, paragraph separator) .*
        • between 0 , unlimited times, many times possible, giving needed (greedy) *
    • pcre 8.34–8.35 utf-32 interprets part differently .*
      • match single character not line break character (line feed) .*
        • between 0 , unlimited times, many times possible, giving needed (greedy) *
    • java 8: assert position @ word boundary (position preceded or followed—but not both—by unicode letter, digit, or underscore) \b
    • pcre 8.34–8.35 utf-32: assert position @ word boundary (position preceded or followed—but not both—by ascii letter, digit, or underscore) \b
    • match character string “local” literally (case sensitive) local
    • match single character “whitespace character” (ascii space, tab, line feed, carriage return, vertical tab, form feed) \s
    • match character string “service” literally (case sensitive) service
    • java 8: assert position @ word boundary (position preceded or followed—but not both—by unicode letter, digit, or underscore) \b
    • pcre 8.34–8.35 utf-32: assert position @ word boundary (position preceded or followed—but not both—by ascii letter, digit, or underscore) \b

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -