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
Why am I getting "inadmissible input" for regex in "finds" expression?
I have a Generate Attributes operator with an expression that uses the "finds" function. It takes the existing nominal attribute Link_prefix, which contains URL strings, and I want to check for the existence of an IP address in the URL. My expression looks like this:
finds(Link_prefix, "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
i.e. a regex looking for four numbers from 1-3 digits, separated by periods. However, it gives me the following error message: Error: Inadmissible input at "". It has an arrow pointing at the opening quotes in the regex expression. What am I doing wrong? Why is the opening quotes of the regex producing an error? I've looked at several questions in RapidMiner Community with examples of regex expressions, and they look like they're formatted the same way mine is.
My xml details are as follows. (Please don't ask for the entire process xml. It's lengthy, and sensitive.)
- Version:
- Operator:
Thanks for any help!! I'm getting frustrated with repeated roadblocks in simple attribute extraction, before I even get to the modeling.
finds(Link_prefix, "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
i.e. a regex looking for four numbers from 1-3 digits, separated by periods. However, it gives me the following error message: Error: Inadmissible input at "". It has an arrow pointing at the opening quotes in the regex expression. What am I doing wrong? Why is the opening quotes of the regex producing an error? I've looked at several questions in RapidMiner Community with examples of regex expressions, and they look like they're formatted the same way mine is.
My xml details are as follows. (Please don't ask for the entire process xml. It's lengthy, and sensitive.)
- Version:
<?xml version="1.0" encoding="UTF-8"?><process version="9.0.003">
- Operator:
<operator activated="true" class="generate_attributes" compatibility="9.0.003" expanded="true" height="82" name="Generate Attributes (4)" width="90" x="581" y="34">
<list key="function_descriptions">
<parameter key="IP_in_link" value="finds(Link_prefix, "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")"/>
</list>
</operator>
Thanks for any help!! I'm getting frustrated with repeated roadblocks in simple attribute extraction, before I even get to the modeling.
Tagged:
0
Best Answer
-
jacobcybulski Member, University Professor Posts: 391 UnicornTry changing you backslashes into double backslashes. The first will ensure that the second will be used as part of your regular expression, otherwise a single backslash before "d" would simply escape "d" making it a "normal" character (which already is). In other words use the following function with a regular expression:Jacob
- finds(URL,"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")
2
Answers