I am trying to return a match of only uppercase in EasyPatterns
An example:
Let>text=abc 12ABC 4456 abc
Let>pattern=[3UPPER]
RegEx>pattern,text,1,matches,num,0
MessageModal>matches_1
This should return "ABC" but it returns "abc". I have checked the Easy Pattern Reference and it says
[upper], [uppercase], [uppercaseLetter]
should all work, however it does not and it also mentions that match case may need to be turned on.
Any ideas how this can be accomplished?
return uppercase with easypatterns
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Not sure how to turn case insensitivity off in EasyPatterns. So here's how to do it with ordinary RegEx:
Let>str=abc 123 ABC 333 abc
RegEx>(?-i)[A-Z]{3},str,0,matches,nm,0
The (?-i) turns off case insensitivity. [A-Z] says match any characters between A and Z and the {3} says match three of them.
Let>str=abc 123 ABC 333 abc
RegEx>(?-i)[A-Z]{3},str,0,matches,nm,0
The (?-i) turns off case insensitivity. [A-Z] says match any characters between A and Z and the {3} says match three of them.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Easy Patterns
Does anyone know of any other functions besides
[upper], [uppercase], [uppercaseLetter]
that do not work in EasyPatterns?
[upper], [uppercase], [uppercaseLetter]
that do not work in EasyPatterns?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
I don't think it's quite the case that they don't work. Easypatterns is basically a mapping between plain english keywords and regex patterns. Trouble is because the regex engine used in Macro Scheduler is case insensitive by default, and UPPERCASE probably just maps to [A-Z] which in RegEx would also match lower case, it's really not doing anything wrong - just doing what RegEx would also do by default. And as the case mode modifier is specific to the RegEx engine it's probably not something that easypatterns can easily map to, as it depends on the RegEx engine. Arguably therefore, it's not easypatterns at fault but a missing option in the RegEx command that would allow you to set mode modifiers. At present the only way to do that is with plain PCRE RegEx itself, so for now you need to use plain RegEx for this.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Case they don't work
I don't understand the "I don't think it is quite the case that they don't work". It does not work, so you are saying I have to redo it with a regular expression. For me that is much easier said than done.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Sorry. Perhaps I should not provide technical explanations in future. Well, my magic wand is in for a service right now, so I'm afraid my workaround will have to suffice for now. If possible we will see if we can modify the EasyPatterns source to manipulate the case mode modifiers. But that won't get you a solution today. I did not intend to offend.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
EasyPattern
Marcus, you could never offend.
The difficulty was in not knowing. It would have been very easy to build in Regular Expressions; however, there are so many verisons I (this is me) always had trouble with the correct one to use. Perhaps that has changed now and the syntax for Perl, VB etc are all the same.
Because of that I went with EasyPatterns as lets face it, it is easy. Well to redo it now is not so simple as it is at least a week of work as I use them all over and have to recomple, rewrite instructions, create new installs etc.
The difficulty was in not knowing. It would have been very easy to build in Regular Expressions; however, there are so many verisons I (this is me) always had trouble with the correct one to use. Perhaps that has changed now and the syntax for Perl, VB etc are all the same.
Because of that I went with EasyPatterns as lets face it, it is easy. Well to redo it now is not so simple as it is at least a week of work as I use them all over and have to recomple, rewrite instructions, create new installs etc.