Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Help with REGEX Replace

BarryF
5 - Atom

Hi

 

First time poster on the Community.

 

I need to be able to replace any punctuation (comma, apostrophe, hyphen, fullstop) from a string of text , but only where those items are within text.

The string of text also holds numeric fields so I don't want to replace the fullstop/decimal point from the numeric fields.

 

e.g

Mr Smith 504.53 1 High Street St. Helen's

needs to be

Mr Smith 504.53 1 High Street St Helens

 

Any help appreciated

2 REPLIES 2
bbaker
7 - Meteor

Hi Barry,

 

Try the following:

REGEX_Replace([Field1], "[^a-z\sA-Z0-9.]|(?<!\d)\.(?!\d)", "")

 

In the first portion [^a-z\sA-Z0-9.] we are looking to match any value not contained in the bracket.

OR

In the second portion (?<!\d)\.(?!\d) is looking to not match the Digit Period Digit Pattern.

 

bbaker_0-1595422605677.png

 

 

BarryF
5 - Atom

Thanks bbaker...worked perfectly 🙂

Labels
Top Solution Authors