The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Issues with regular expressions"
IngoRM
Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
Original message from SourceForge forum at http://sourceforge.net/forum/forum.php?thread_id=2034662&;forum_id=390413
The following regular expression works in RapidMiner: '[A-Z][a-z]+', when applied to any text, to extract words that begin with an upper case.
However, if I add any space definition, it does not work. For example: '[A-Z][a-z][ ][A-Z][a-z]+', does not get recognized as a valid regular expression.
The same expressions work well in other regex text editors.
Any ideas on why RapidMiner is not recognizing the space definiton?
Thanks,
FDR
Edit by topic starter:
I found the answer shortly after posting this; spaces seem to be defined by \s as in:
'\s[A-Z][a-z]+\s[A-Z][a-z]+'
The expression above works. However, it does find only the first occurrence of the match. Any ideas on how to get all occurrences?
Answer by Ingo Mierswa:
Hi,
the regular expressions should be the same as they are supported by Java as explained here:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
I am not too sure but it might be that capturing groups can help here:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#cg
Cheers,
Ingo
The following regular expression works in RapidMiner: '[A-Z][a-z]+', when applied to any text, to extract words that begin with an upper case.
However, if I add any space definition, it does not work. For example: '[A-Z][a-z][ ][A-Z][a-z]+', does not get recognized as a valid regular expression.
The same expressions work well in other regex text editors.
Any ideas on why RapidMiner is not recognizing the space definiton?
Thanks,
FDR
Edit by topic starter:
I found the answer shortly after posting this; spaces seem to be defined by \s as in:
'\s[A-Z][a-z]+\s[A-Z][a-z]+'
The expression above works. However, it does find only the first occurrence of the match. Any ideas on how to get all occurrences?
Answer by Ingo Mierswa:
Hi,
the regular expressions should be the same as they are supported by Java as explained here:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
I am not too sure but it might be that capturing groups can help here:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html#cg
Cheers,
Ingo
Tagged:
0