REGEX: DOS FindStr Command Has No Inverse Class Capability?
The documentation says that FindStr handles inverse class syntax, such as finding any character that does not match 'X': [^X] But a few simple tests show this is not the case - at least not on my Windows 7 x64 setup. Findstr treats the inverse class notation '^' as if it is not there at all. So it sees the above regex as this: [X] I'm wondering if anyone knows a way to trick FindStr to recognize the '^' inverse class notation? Yes I could use a different tool besides FindStr, but that is often the tool already installed on a Windows setup.
The ^ is the escape character in cmd.exe. You must escape it (analoguous to \ in other environments). Try: [^^X]
Are you enclosing the search expression in double quotes? IIRC an unquoted ^ will simply quote the next character literally, which sounds like what you are reporting.
Here is an example, that works: echo 123|findstr /R "[^0-9]" finds nothing as expected. The same without quotes does not work.
How to use sed to remove lines with pattern in square brackets
Jmter complicated regular expression solution? [duplicate]
Google analytics filter RegEXp assistance
RegEx design a pattern to extract id from url?
Regular Expressions | Delete words on multiple lines before a given word
Findstr - Return only a regex match
Converting VB function to Regex?
how to put text after a line beginning with http?
How to find a regex in re2 to search between strings?
How to combine two lists in one list? using notepad++ regex? [duplicate]
Scala - Explanation for regex statement
Python Regular Expression Multiple Groups
Using regexp in Matlab to find specific file from beginning and end components of filename
regular expression to check ends with a digit
Regex to capture string until another string is encountered
Google apps script, getBody() from Gmail, regex \n