You are viewing limited content. For full access, please sign in.

Question

Question

Parenthesis in Pattern Matching doesn't appear to be working

asked on April 23, 2014 Show version history

I'm using the pattern matching in QF:

 

Member#:\s+(\d{6}\s\d{2})

 

Most of the returns are correct, but about 10% include other characters in the prefix.  For instance, the correct return member number should be:

 

123456-01

 

but I'm getting a return similar to:

 

!:-123456-01

 

I also sometimes get a U instead of a zero in the member number.

0 0

Replies

replied on April 23, 2014

Is the option labeled return the input value when no match is found on in the Pattern Matching dialog?

1 0
replied on April 23, 2014

Yes; in the Action section there is a check in the "Use the input value as the token value" box.

0 0
replied on April 23, 2014

Your pattern didn't match anything in those cases, it sounds like you want it to return blank when it fails? So you'd want to turn that option off.

0 0
replied on April 23, 2014

The pattern did match, but it returned extra characters before the 6-digits.  I don't want blank returned, I just want the 6-digit dash 2-digit number to be returned which is why I placed the parenthesis around it.  It's easier for us to go back and remove the few characters than to type in the member number.

0 0
replied on April 24, 2014

Are you saying you're still getting "!:-123456-01" after you turn off the option to return the input data when no match is found?

0 0
replied on April 25, 2014

Your pattern above is "Member#:\s+(\d{6}\s\d{2})" which reads as  "return 6 digits, a space, 2 digits when you find them after the string 'Member#:' followed by one or more spaces".

 

"!:-123456-01" does not match that, so it is returned as the input value if that option is on.

 

If you do want the input value when pattern matching fails for the user to correct later, you can put a constraint on the field in Quick Fields. You will still get the data, but Quick Fields will flag the documents that have field where the data does not match the constraint

0 0
replied on April 28, 2014

I do not want blank returned; therefore, I do want the input value to be checked (which it is). This is working  about 90% correctly.  I do have a constraint, as I described.  What I do not understand is why I am getting the "!:-" prefix to the member ID when I have clearly indicated what I want between the parenthesis (\d{6}\s\d{2}) on the remaining 10% that are returned.

0 0
replied on April 28, 2014

There seems to be some confusion as to how Pattern Matching works.

 

If you indicate a match group by itself, then that data is extracted regardless of the surrounding text. For ex, (\d{6}) will return 6 digits no matter what your input value is:

 

Member#:  123456-01   ----> 123456

123456 345  ----> 123456

!:-123456 001 ----> 123456

 

When you add text in front or after the match group, you are saying you only want the text in parentheses extracted if the extra text is there too. So there are now 2 parts to it: first match the whole string, then extract the data in parentheses. For ex, "Member#: (\d{6})" will only extract the 6 digits when it finds them preceded by "Member#: "

 

Member#:  123456-01   ----> 123456

123456 345  ----> nothing

!:-123456 001 ----> nothing

 

If your input value is "!:-123456-01", it will fail once it finds no "Member", so no data extraction will be performed. When the pattern is not matched, you get the input value as is.

0 0
replied on May 7, 2014

There is no confusion.  There are no characters between Member#: and the six dash two digits I'm requesting.  LF is inserting these three characters, as described.

 

Here's my data and what should be returned based on my pattern:

 

Member#: 123456-01    ---->  123456-01

 

Member#: 123456-02    ---->  123456-02

 

Where is the !:- coming from?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.