The regex in the question is a weird way to match simple words. It's not clear what the expected input is. Perhaps, input can justify this approach.
^(?=.\bABDUL\b)(?=.\bHAI\b.)(?=.\bMANSOOR\b).*$
This means: the beginning must be any character that is not a word, followed by ABDUL, a non-word character, HAI, a non-word character, MANSOOR, a non-word character or the end of the string.
This means: the beginning is not a number or alphanumeric character (alphanumeric character), ABDUL, a non-alphanumeric character, HAI, a non-alphanumeric character, MANSOOR, a non-alphanumeric character or the end of the string.
I haven't tested it and have no intention of making it exactly the same as the first one, but it should be close enough.
For anyone who wants to copy this into their code:
Matching the first character is unusual and may be a bug in the original regex.
(?=...) is a "lookahead assertion" that consumes no characters, the POSIX version does not have it, but may not matter for simple string searches.
Both versions should match strings like !ABDUL$HAI)MANSOOR - make sure this is what you want.
For those who want to understand the regular expressions I use, you can refer to the following link:
The regex in the question is a weird way to match simple words. It's not clear what the expected input is. Perhaps, input can justify this approach.
This means: the beginning must be any character that is not a word, followed by ABDUL, a non-word character, HAI, a non-word character, MANSOOR, a non-word character or the end of the string.
This means: the beginning is not a number or alphanumeric character (alphanumeric character), ABDUL, a non-alphanumeric character, HAI, a non-alphanumeric character, MANSOOR, a non-alphanumeric character or the end of the string.
I haven't tested it and have no intention of making it exactly the same as the first one, but it should be close enough.
For anyone who wants to copy this into their code:
!ABDUL$HAI)MANSOOR
- make sure this is what you want.For those who want to understand the regular expressions I use, you can refer to the following link:
https://dev.mysql.com/doc/refman/8.0/en/regexp.html (POSIX syntax for mysql) and https://docs.python.org/ 3/library/re.html (PCRE for python = Perl compatible syntax)