Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
There's still time to register for the Q3 ACE Panel - Spatial Edition presentation tomorrow! | Need more information about the event? Check out the post here

Syntax to find if a field contains special characters only

Highlighted
8 - Asteroid

Hi

I have a requirement to find out if a field(string) contains special characters only.

Please could you let me know how do I do it?

 

Street Name                     Result

ABC-                                 False

-                                        True

#$--                                   True

ABC – 98                          False

ABC xy                             False

ABC – xyz                        False

 

Thanks

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@Meena,

 

Here's a regular expression to help you:

 

REGEX_CountMatches([Street Name], "[a-zA-Z0-9\s]")=0

It counts the occurrences of letters and numbers and spaces and if that count is ZERO, then it is true.  It gives you a TRUE on NULL addresses.  If you want to avoid NULL addresses being TRUE, then:

 

IIF(IsNull([Street Name]),"False", REGEX_CountMatches([Street Name], "[a-zA-Z0-9\s]")=0)

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
13 - Pulsar

Something like this in a Formula tool will work:

 

!REGEX_Match([Street Name], ".*[\w].*")

 

Hope it helps!

Labels