regex


Regular Expression for Ignoring Files that Begin and End with a Sequence


I am using Sublime Text 2 and trying to filter out any files that do not begin with a string sequence or end with a string sequence.
Here are some samples with my desired outcome:
AAA.123.ZZZ = TRUE
AAA.MY.SPECIAL.FILE.ZZZ = TRUE
ABC.123.ZZZ = FALSE
AAA.123.XYZ = FALSE
/SUBFOLDERNAME = FALSE
FILE NAME WITH WHITESPACE.TXT = FALSE
I am using the following expression, but many files are getting by the filter:
^(?!AAA\..*\.ZZZ$)[\w\.-]+$
I want to include this regular expression in the Sublime Text 2 SFTP configuration under the "ignore_regexes" section.
I realize this is a double negative (using an ignore an inverse match), but I want to be able to replace AAA and ZZZ so that only files that begin with AAA. and end with .ZZZ are included by Sublime SFTP.
I don't know if you can find something simpler, but the following appears to work:
^(?!AAA\.).*|.*(?<!\.ZZZ)$
as illustrated in http://rubular.com/r/3yUXh0TOfE
Or, if you need to avoid the negative lookbehind, you can use:
^(?!AAA\.).*|.*(?!\.ZZZ).{4}$
as illustrated in http://rubular.com/r/VUd3yAQTzl

Related Links

Batch rename screen shots on Mac OS X
US Phone regex that works in IE
Regex with lookaround for Lazarus
codeigniter regular expression for uri slug in routes
regex to match strings not preceded by a bang
What would the regex to match the hostname of this string?
How do I do a regex search and replace in sublime text 2?
Why are these regular expressions different?
r regex mileage
What is the complexity (Big-O) of searching an indexed data in mongoDB?
Filtering multiline pcregrep match with sed
How to remove a word prefix using grep?
How to create a regexp that catches everything that isn't a pure number
Print text at end of semicolon Sed/awk
Perl script, find first half of string [closed]
Perl regular expression to find a exact word

Categories

HOME
mocking
logstash
bootstrap-4
google-search
angular2-forms
python-3.5
genetic-algorithm
spacemacs
apple-mail
wget
plotly
avplayer
sqlconnection
graphengine
cytoscape.js
command-line-arguments
signature
google-cloud-sdk
helpers
atmelstudio
org-mode
co
line-breaks
jsgrid
mathdotnet
listbox
structure
code-signing
text-parsing
trial
instance
imageshack
apex-code
edit-distance
sieve-of-eratosthenes
chamilo-lms
folly
kmdf
solid-principles
visualsvn-server
easy-digital-downloads
mergesort
program-slicing
oracle-aq
spring-form
node.js-tape
derbyjs
masm32
bosh-deployer
tastypie
breach-attack
dashing
balsamiq
pager
geneos
oracle-policy-automation
webmail
membership
openejb
tun
translucency
bonfire
error-log
react-rails
boost-coroutine
pencilblue
textmatching
zim-database
conditional-statements
modern-ui
jasmin
office-2010
gdk
asf
iphone-privateapi
zeroclipboard
aps
cellular-automata
mouseenter
wmv
windward
serverside-javascript
libtorrent-rasterbar
nsusernotificationcenter
rte
zephir
firebird2.1
kmz
jflow
cassette
locomotivejs
eject
google-provisioning-api
lungojs
android-screen
consistent-hashing
openid4java
exact-synergy-enterprise
jammit
.net-1.1
remote-control
time-estimation
gedcom

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