regex_match
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
n one of our workflows there is a validation done in order to check if a column/value it's a numeric value or not.
The expression is working with numbers higher than 0,09. IF values are lower or equal to 0,09 then if fails.
IF REGEX_Match(ToString([XXXXXXX]), "^\d+(\.\d+)?$")
THEN ""
ELSEIF
IsEmpty([XXXXXXX])
THEN ""
ELSEIF
REGEX_Match(ToString([XXXXXXX]),"^\d+(\.\d+)?$")
THEN
"XXXXXXX - Input must be positive values only"
ELSE
"XXXXXXX - Input must be numbers only"
ENDIF
I've tried replacing the expression with "^\d{1,3}(,\d{3})*(\.\d+)?|\d+$" but it didn't work.
Does anyone know how to solve this issue?
Thanks!
- Labels:
- Predictive Analysis
- Topic of Interest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@aastorga @Can you provide some sample data and expected results?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I tried but didn't work ☹️
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @aastorga
Try this:
IF REGEX_Match(ToString([XXXXXXX]), "[\d,\.]+")
THEN "OK"
ELSEIF
IsEmpty([XXXXXXX])
THEN ""
ELSEIF
REGEX_Match(ToString([XXXXXXX]),"[\d,\.-]+")
THEN
"XXXXXXX - Input must be positive values only"
ELSE
"XXXXXXX - Input must be numbers only"
ENDIF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Tried it but didn't work. Seems to be linked with the way Alteryx is transforming some values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That value has a letter near the end so I think the logic works.
I agree the scientific notation seems strange. What type of source is the data coming from?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The input file is an Excel format and the field we want to check is defined as
What we are currently investigating looks like below
IF IsEmpty([Conversion Cost 24]) or IsNull([Conversion Cost 24])
then "Field is empty"
ELSEIF
REGEX_Match(ToString([Conversion Cost 24]), "-?\d\.\d+[Ee][+\-]\d\d?")
THEN "Field OK: scientific notation"
ELSEIF
REGEX_Match(ToString([Conversion Cost 24]),"[\d,\.-]+")
THEN
IF REGEX_Match(ToString([Conversion Cost 24]),"^\d+(\.\d+)?$")
then "Field is OK"
ELSE "Conversion Cost 24 - Input must be positive values only"
endif
ELSE "Must be numerical"
ENDIF
Seems to work but we still need to confirm. Indeed the scientific notation seems strange
![](/skins/images/5A278AAD67B5F68761E04A0A1AFFBB3D/responsive_peak/images/icon_anonymous_message.png)