regex


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.

Related Links

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)

Categories

HOME
common-lisp
logstash
bolt-cms
genetic-algorithm
c++14
sony
google-adwords
predictionio
regression
autofac
message
ssrs-tablix
raspberry-pi2
orientdb-2.1
pywin32
thrift
lexikjwtauthbundle
textmatebundles
teamcity-9.0
smartcard
jpos
semantics
jcrop
php-carbon
android-arrayadapter
asana-api
true-type-fonts
evercookie
scom
qweb
bem
dsx
hawkular
angular2-seed
formatdatetime
autofocus
arm7
uservoice
multistore
website-hosting
notimplementedexception
okular
glfw
column-oriented
flying-saucer
email-notifications
vispy
error-correction
flattr
printscreen
webtrends
sql-server-2016-express
qlpreviewcontroller
rabbitvcs
jquery-load
relaxng
session-replication
android-listfragment
xsb
sketching
bloodhound
structured-programming
ehcache-bigmemory
getuikit
openxls
spiceworks
catalina.out
iqueryable
deepzoom
lightstreamer
junit-runner
ramdisk
batman.js
disabled-input
flash-cs4
pubdate
mms-gateway
progressdialog
dependency-walker
wescheme
haar-wavelet
51degrees
working-directory
xml-dtd
google-profiles-api
datatemplate
pinging
code-statistics
variable-names

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App