Is logical logic in one regular expression possible?

Is it possible to insert one regular expression, logical logic: the line starts with 'a' or 'b'. The question is launched using the FileHelpers utility, which has a "Record Condition Selector" text field for "ExcludeIfMatchRegex". The utility is written in C #. ^ a - works, just don't write ^ a OR ^ b

+3
source share
4 answers

use the |(pipe) function :

^a|^b

Or in advanced formatting:

^a   # starts with an A
|    # OR
^b   # starts with a B
+6
source

How about this: ^ [ab]

+5
source

, ... , "a" "b", :

^(a|b)(.+)$

, , "a", "b", .

+3

(?ifthen|else) . if true, . else. . , if, . . else .

Read more on the conditional page regex.info for more details.

+2
source

Source: https://habr.com/ru/post/1722635/


All Articles