Moderators Melba23 Posted August 3, 2009 Moderators Share Posted August 3, 2009 Evening all,I was trying to develop a simple SRE pattern to match files with a specific extension and rather to my surprise, given my allergic reaction to most things SRE, managed to do it:(?i).*\.xyzHowever, when I tried to use this pattern, I found that it would match both fred.xyz and fred.xyz.bak - just my luck to have an application which merely adds .bak to the original filename. At the moment I am working round the problem by checking a second time with(?i).*\.bakto omit the backups, but I am sure it can be done in one pass.I have been racking my brains to develop a single SRE pattern which will match *.xyz and not *.xyz.bak but have had no luck so far and my brain is beginning to hurt >_< . Could some kind soul either point me very firmly in the right direction or give me a solution?Thanks in advance for any help.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
zorphnog Posted August 3, 2009 Share Posted August 3, 2009 Try this: (?i).+\.xyz\z Link to comment Share on other sites More sharing options...
Szhlopp Posted August 3, 2009 Share Posted August 3, 2009 .*\.xyz[^\.] Thars you go. Matches a specific filetype=) RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Authenticity Posted August 3, 2009 Share Posted August 3, 2009 If the string should be a single line string of a filename you can match by position \.xyz$. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2009 Author Moderators Share Posted August 3, 2009 Thanks all. Brain temperature now returning to normal levels. >_< M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now