community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

ReGex Parse tool: Why isn't \D+ matching a less-than (<) symbol?

Highlighted
Asteroid

I'm new to RegEx and this is driving me crazy.

 

I'm trying to find non-numeric characters in a data field that should be numeric.

In this case one of my users entered '< 85' in their spreadsheet.

 

I've set up a RegEx Parse to look for \D+, which to my understanding should match any field that contains one or more non-digits.  My output method is Match, but this expression is not matching the '< 85'.

 

I tested it on https://regex101.com/ and it matches in their tester, so I'm not sure what's going on here.

 

Tiny example workflow attached.

 

Thank you!

Quasar

random guess, but it could be the space. I'm not sure how non-digit accounts for spaces.

Alteryx Certified Partner
Alteryx Certified Partner

Hi @jlefeaux 

 

Match mode on RegEX checks the whole string for a match.

 

So basically, \D+ is checking if the whole string is a non-digit expression.

 

Cheers,

Alteryx Certified Partner
Alteryx Certified Partner

@jlefeaux 

 

Try ^\d*\D+\d* 

 

Can your numbers be decimals? If so, you have to consider the (.) as a character as well.

 

Cheers,

Asteroid

Hi @Thableaus.  Thanks for your suggestion, but sadly it did not work.

 

I've extended the sample workflow to include 2 bad examples and ^\d*\D+\d* did not catch either of them.

 

Capture.PNG

 

It's a good point about the decimal place & I will definitely address that once I get this issue figured out.

Alteryx Certified Partner
Alteryx Certified Partner

@jlefeaux 

 

You're adding an extra whitespace after the expression "^\d*\D+\d*"

 

Take off the extra whitespace at the end of the RegEX and it'll work.

 

Cheers,

Alteryx Certified Partner
Alteryx Certified Partner

@jlefeaux 

 

To match cases like <85+81 - let's say, non-digits with more digits

 

(^\d*\D+\d*)+ would do the trick.

 

Cheers, 

Asteroid

 

@Thableaus ,

 

Arrgh, the whitespace came from copying & pasting from the webpage.

 

Removing the whitespace worked on the sample set in my example... But your new expression did not match <85+81

 

I've updated the tiny workflow with '(^\d*\D+\d*)+' and '<85+81'  & included it here if you are interested in pursuing the question.  Regardless, I'm going to mark your previous post as the solution.

 

Thank you!

Alteryx Certified Partner
Alteryx Certified Partner

@jlefeaux 

 

Sorry, it's ^(\d*\D+\d*)+

 

^ refers to the beginning of the line. So it happens just once.

 

Cheers,

Asteroid

Ummm, acutally, no... it didn't :D

Labels