-1

Trying this now for a while and I have lost my knowledge...

How can I match any string pattern "OOC"? Starting or ending with a space or non-alphanumerical charachter?

no match | asdOOCasd
no match | asdasdOOC
no match | OOCasdasd
match    | asd OOC asd
match    | asd-OOC-asd
match    | (OOC)
match    | -OOC- 
match2x  | asd OOC asd OOC asd

:$

WG-
  • 938
  • 2
  • 12
  • 27

1 Answers1

1

Use this:

[^a-zA-Z\d](OOC)[^a-zA-Z\d]
  • ^ - Negates everything inside square brackets, so it matches non numeric characters and non letters.

  • a-zA-Z - Matches all the letters.

  • \d - Numeric class.

Ankit
  • 594
  • 1
  • 4
  • 12