I need logical AND in regex.
something like
real AND substance (or simply subs)
agree with only following string (in any order)
Real Substance
but not
Real Substance External
Real substance group
I need to use the REGEX in SAP ABAP. Please help.
I need logical AND in regex.
something like
real AND substance (or simply subs)
agree with only following string (in any order)
Real Substance
but not
Real Substance External
Real substance group
I need to use the REGEX in SAP ABAP. Please help.
Alexander's answer assumes that Regular Expressions in ABAP accept the modifiers *? and ?? but they don't, so simply use * and ? instead, as follows:
^(?:real\s*subs(?:tance)?|subs(?:tance)?\s*real)$
UPDATE TO ALLOW for "subs"
Naive approach would be:
^(?:real\s*?subs(?:tance)??|subs(?:tance)??\s*?real)$
Try it here: https://regex101.com/r/7RznVy/3
Don't know if your tool allows flags; use "i" to make case-insensitive.
I recommend you to read the classic: Mastering Regular Expressions by Jeffrey Friedl