Topic RegEx

Dom started the topic:
2017-03-15 20:32

RegEx

Hi - I'm looking to run a RegEx as follows which works within http://RegExr.com but does not run in DataCleaner

The purpose is to strip out the GCE and A'Levels rows from an input file to put Valid rows into a new temporary - I'm using the Validate with String Pattern

(\bGCE\b)|([^\w]A\sLevel)|(\bAS\b)|('?A2'?)

Is there another way to do this?
Dennis replied:
2017-03-17 13:24
Hi Dom,

What is the issue you're seeing? As I'm testing, it seems to work as intended:
GCE
-A Level
AS
'A2'
A2
... Are all caught when I use that regex, other strings (except of course other non-word characters in front of "A Level") are not.

Are you possibly expecting it to catch them even if in the middle of other text? We're matching on the complete text, so in that case you'll need to sandwich your regex in ".*", like this:
.*((\bGCE\b)|([^\w]A\sLevel)|(\bAS\b)|('?A2'?)).*

Hope that helps, otherwise you'll have to give some examples of values you expect to match and values you don't.
You are not signed in.
You need to be signed in to participate in the discussion.