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.
Perl Binary/PCAP regex
Why does grep match all lines for the pattern “\'”
regular expression for C if statementch
Regular expression for search name of methods in java files
Recommendation - Resource/book/pocketbook on regex in SED [closed]
Perl: composing regex thru interpolation when subexpr has capture
RegExp regular expression find & replace whole words only
Given a certain regex pattern, re-arrange and manipulate the contents of a cell
Regular expression“\\|” in strsplit
Parsing sectioned file with augeas
I need search a pattern in a header line of my file and concatenates the next line with Perl
Regular Expression statement to replace text inside two literals
RegEx pattern with not followed by
How to pull words based on positioning from a text element using Regex?
Remove C/C++, Multiline comments from a array in which file is read
Regexp match time expression (mmmm:ss)