Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
8 posts • Page 1 of 1
8 posts
• Page 1 of 1
SudoBen
Posts:11
Joined: Fri Apr 08, 2011 9:25 am
RegEx
Postby SudoBen »
Hello again,
i have run into another Problem:
I'm triing to filter DP Names that are hold in a dyn_string via dynPatternMatch.
The Names are always build up llike device__property_propertyOfProperty_....
I am trying to filter all properties of the first level that do NOT have child properties.
I supposed the Regex to be something like
"*Device_??_/[[:alpha:]/]+"
"*Device_??_[:alpha:]+"
"*Device_??[/a]+"
"*Device_??[a-zA-Z]+"
I don't think dynPatternMatch() supports Regex. It's more like fnmatch() or "globbing".
EDIT:
It's probably easy to miss, but the online help says:
The asterisk "*" replaces any number of characters, the question mark "?" replaces any character, characters in square brackets one of the characters specified in brackets.
Your'e right it behaves like gobbing,
but the help states (dynPatternMatch):
Under Linux, the same rules for pattern apply as those that apply in Linux command lines for addressing files: These rules can be retrieved with "man 5 regexp" on Linux computers.
What I need to find is a pattern that matches e.g. 3 digits and 4 chars.
Is that possible to archive with WOA? Or are * and ? the only supported wild cards (no character classes and complements available)?
Ok, i found a (not very elegant) way:
[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][1234567890][1234567890][1234567890][1234567890][1234567890]
:woohoo: :woohoo: :woohoo:
But maybe someone comes up with a better solution :unsure:
Here's an alternative: Since Ctrl is extensible, you can help yourself out regarding regex support.
I put together this little experimental Ctrl Extension last evening: https://github.com/mooware/CtrlRegex. It provides replacements for patternMatch() and dynPatternMatch() based on the QRegExp class from Qt. And the bonus is, it even supports real globbing if you specify the pattern type "wildcard".