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

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

Categories

HOME
ssis
clojure
youtube
watson
windows-runtime
feed
gluu
stripe-payments
application-cache
wikipedia-api
windows-server-2012-r2
sony
sony-camera-api
py.test
android-vision
pie-chart
aac
nsmutableattributedstring
jmeter-plugins
multiprocessing
opencms
rrd
iar
arduino-esp8266
asana-api
mobile-center
charts.js
stomp
react-redux-form
apex-code
deep-copy
gridstack
executorservice
ecdsa
sourcetree
drupal-webform
windows-scripting
rft
angularjs-routing
pulseaudio
hostapd
requirements-management
asyncsocket
fido
stroke
easyhook
flying-saucer
lcov
android-camera-intent
ipmi
kie-workbench
shift-reduce-conflict
vispy
error-correction
sound-synthesis
xnamespace
telecommunication
bash-completion
vimeo-ios
aplpy
lidar
metalkit
genetic
pypdf
linqtocsv
samsung-gear
materialdrawer
json4s
android-gpuimageview
android-listfragment
node-orm2
pegkit
keypad
ehcache-bigmemory
window-server
theorem-proving
simpleadapter
android-tablelayout
django-supervisor
ituneslibrary
azimuth
lightstreamer
gora
memoization
ccombobox
geometry-surface
xsocket
hiphop
51degrees
xml-dtd
dired
xmltextwriter
coolstorage
hunchentoot
renderaction
anemic-domain-model
plumtree

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