0

Anyone can help to modify my regex? The idea is that all the strings below should not be matched (but I got 4 matches), The goal is that to match only for those strings do not appear on the list below, but the strings should begin with RXHOST.

Pattern: /(?:^RXHOST|^rxhost)([a-zA-Z0-9\s-].-{2,}[a-zA-Z0-9\s-].|[a-zA-Z0-9\s-].\s{2,}[a-zA-Z0-9\s-].)/gm

See in full at: https://regex101.com/r/5l0wDV/1

Strings:

RXHOST ZZ PQ1-P-TAS-QZV4YTTT5645644-SIT-01JAN79-VL-01JAN30-MANAGE-TIME-OVER ALL-H/F1/Z3
RXHOST ZZ PQ1-A-TAS-XZV456NGFF45644-MIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-H/F1/Z3
RXHOST ZZ PQ1-I-TAS-BZV456456FF44-GIT-01JAN79-VL-01JAN30-MANAGEMENT-TIME/F1/Z3
RXHOST ZZ PQ1-D-TAS-UZV4QQ5645644-SIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-OVER ALL-H/F1
RXHOST ZZ PQ1-F-TAS-TZV45QDF645644-SIT-01JAN79-V-01JAN30-MANAGE-TIME-H/F1
RXHOST ZZ PQ1-P-TAS-PZV45FF645644-SIT-01JAN79-JL-01JAN30-MANAGEMENT-TIME/F1
RXHOST ZZ PQ1-P-TAS-QZV456FBF45644-QIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-OVER ALL-H/Z3
RXHOST ZZ PQ1-I-SAT-TZV456FGF45644-EIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-H/Z3
RXHOST ZZ PQ1-P-SAT-OZV456EWEW45644-TIT-01JAN79-VL-01JAN30-MANAGE-TIME/Z3
RXHOST ZZ PQ1-P-SAT-ZZV456GFG45644-SIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-OVER ALL-H
RXHOST ZZ PQ1-D-SAT-XZV4HHH5645644-YIT-01JAN79-V-01JAN30-MANAGE-TIME-H
RXHOST ZZ PQ1-A-SAT-JZVOPPO45645644-PIT-01JAN79-JL-01JAN30-MANAGEMENT-TIME

Matches: (This is not supposed to be matched)

RXHOST ZZ PQ1-I-TAS-BZV456456FF44-GIT-01JAN79-VL-01JAN30-MANAGEMENT-TIME/F1/Z3
RXHOST ZZ PQ1-D-TAS-UZV4QQ5645644-SIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-OVER ALL-H/F1
RXHOST ZZ PQ1-P-TAS-PZV45FF645644-SIT-01JAN79-JL-01JAN30-MANAGEMENT-TIME/F1
RXHOST ZZ PQ1-P-TAS-QZV456FBF45644-QIT-01JAN79-V-01JAN30-MANAGEMENT-TIME-OVER ALL-H/Z3
Juan Tamad
  • 13
  • 4
  • `\s` matches any whitespace, change to a regular space. See https://regex101.com/r/5l0wDV/2 – Wiktor Stribiżew Aug 25 '22 at 17:19
  • The first goal is correct. But the next goal is to match any strings beginning with RXHOST but not identical to the given string above. Example: RXHOST-ZZ-PQ1——10Jan15——SIT——Qdgukfe-shgjqj this should be matched – Juan Tamad Aug 25 '22 at 18:37

0 Answers0