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

Renaming files by using a prefix from text file
Python regex to find words, which also excludes particular words
Regex - exclude search results
Update a line in the AD info field
Sed Match Number followed by string and return Number
Perl matching string with mix of alphanumeric,_ and any number of square braces [closed]
Bash: extract the scheme and host part from a URL string
RexExp find a word within a list of words that are within a parenthesis
Converting EBNF to Regular Expression
Regex rule - allow empty field or special format [duplicate]
Using powershell to search for a pattern
Check odd number of a certain character
Regex: unexpected double replacement [duplicate]
How do I use the sed command to remove all but the first three characters in a line?
“OR” operator in regex, in express routing
Regex add tag to subtitles

Categories

HOME
selenium
coffeescript
pyqt5
android-sqlite
varnish
backand
passwords
amazon-kinesis
google-cloud-dataproc
gluu
active-directory
geany
format
go-gorm
winsql
cross-domain
add-in
square-connect
wso2-das
boxfuse
sql-server-express
w3.css
googletest
rgb
countdown
lookup-tables
slime
code-analysis
point-cloud-library
number-formatting
clappr
udid
mobilefirst-bluemix
titanium-alloy
uistoryboardsegue
weebly
stateful
ulimit
permgen
codeigniter-hmvc
karnaugh-map
maven-jetty-plugin
invalidate
sql-insert
manifoldjs
simple.odata.client
ammonite
billing
findall
wxhaskell
ispconfig
jsbin
formatter
xmllint
dms
cover
okuma
highslide
pakyow
occam-pi
skrollr
win32com
tag-helpers
thinktecture-ident-server
sejda
many-to-one
cbc-mode
alienvault
gem5
gitattributes
theorem-proving
zim-database
newsql
django-postgresql
team-explorer-everywhere
b2b
magic-unipaas
qt4.7
pydatalog
showcaseview
nawk
llblgenpro
qdebug
rcu
domain-mapping
harvest
arr
cellphone
magento-1.5
dired
jammit
jdic
syncml
winamp
remote-control
markitup
posterous
drwatson
greensoftware

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