Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (http://www3.telus.net/pfrank)
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ignore case

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions
View previous topic :: View next topic  
Author Message
blakelyb



Joined: 22 Dec 2007
Posts: 2

PostPosted: Sat Dec 22, 2007 11:22 pm    Post subject: ignore case Reply with quote

One regex site said the /i switch was to ignroe case. But it does not seem to work in PFrank. Is it supposed to work if done right?

Otherwise i just put every letter in bracks with its lower and upper case. Like [Ll][Ii][Kk][Ee] this.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Sun Dec 23, 2007 9:06 pm    Post subject: Reply with quote

The syntax for ignoring letter case using the python style regex (and other styles) is to add the following flag at the start of the regular expression:

(?i)

Your method will work too but it becomes cumbersome to type all double letters and enclose them in square brackets. Instead use:

'(?i)like'

The above will match the word 'like' in all letter cases.
Other flags are also available; these are described in the built-in help (just search for 'flag'.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
blakelyb



Joined: 22 Dec 2007
Posts: 2

PostPosted: Sat Dec 29, 2007 7:42 am    Post subject: Reply with quote

Thanks for the fast help for my question. Now I see I need a parenthesis and a question mark. Before I had tried a slash, like in DOS command switch - wrong.
In the Custom renaming "Search Pattern" box, I tried your suggestion and had to play with it a bit to finally come up with the following, which worked:

(?xi) \[FLAC]

to find [FLAC], or [Flac], or [flac], etc. I wanted the brackets to be searced like regular text. I do not understand what the "?" or the "x" does, but it worked.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Sun Dec 30, 2007 7:38 am    Post subject: Reply with quote

The '(?' syntax is used to indicate the start of a special sequence. If the next characters are alphabetic, then those characters are interpreted as flags. e.g.
(?i) specifies the 'i' flag which indicates to 'ignore case' in the regular expression that follows.

When you use a regex flag you have to be careful with your whitespace because if you add a blank after the flag sequence then that blank is the first character that is going to be matched in your expression.
If you want to use whitespace to make the regex look clearer but not be included in the regular expression then you can use the 'x' flag. The 'x' flag causes whitespace in the expression to be ignored unless it is escaped or enclosed in square brackets.
e.g.
(?i) string1

matches: ' string1' or ' STRing1'

Using '(ix) specifies both the 'i' and 'x' flags.
Therefore:
(?ix) string1

matches: 'string1' or 'STRing1'

I'm surprised that your expression worked because you did not escape the closing square bracket with a backslash.
I would have used:

(?xi) \[FLAC\] # notice the blank after the '(?i)'

or

(?xi) \[FLAC\]

or if you don't use the 'x' flag then the expression would have to be:

(?xi)\[FLAC\]

Hope that clarifies things.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own Video Sharing Site

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com