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

Question

Question

"pattern matching" stop at end of row

asked on March 15, 2022

I need help breaking up an address.  I am trying to isolate the company name.  Here is the format that I am working with:

VENDOR: ABC COMPANY

                  123 MAIN STREET

                  LOS, ANGELES, CA

 

My starting pattern is simple:

VENDOR: (.*)

 

But no matter what I put after I still get the same result of:

ABC COMPANY123 MAIN STREET

 

I've tried things like:

\s?[1-999]

\n

\s?\d.*

.*

 

Any help would be great!

(Side note: what does \n do and how do you apply it properly?)

0 0

Answer

SELECTED ANSWER
replied on March 15, 2022

I did some more digging around and was able to find the following:

([^\r\n]+)

I put in VENDOR:([^\r\n]+) and it worked as expected.

3 0

Replies

replied on March 15, 2022

\n matches the new line character, or the character that is inserted when pressing the Enter Key. You could also use the following pattern :\s(.*)\n

It sounds like you found something that works, however, I would caution that you are currently including the space between the colon and first letter of your vendor name.

0 0
replied on March 15, 2022

Thank you for that info.  I've never gotten \n to work like that for me.  When I tried your pattern, it was still giving me the whole thing.

0 0
replied on March 22, 2022

regex101.com is a great resource for testing expressions, it also explains the reasoning behind patterns. It is possible that the text you are trying to match is using a combination of \n new lines and \r carriage returns.

2 0
replied on March 22, 2022

External resources like regex101.com are great, but just make sure you've selected the correct regular expression engine or "flavor" when you're using them.
 

  • Laserfiche Workflow, Quick Fields, and Connector use .NET regular expressions. The Microsoft Developer Network (MSDN) website has additional information about this type of regular expression, including all supported language elementsbest practices, and examples.
  • Repository Administration uses ECMAScript regular expressions. The Microsoft Developer Network (MSDN) website lists all of the supported language elements.
     

Source: https://doc.laserfiche.com/laserfiche.documentation/en-us/Subsystems/ProcessAutomation/Content/Resources/Regular%20Expressions/Regular-Expressions.htm

And, of course, never post confidential information on such a site (e.g., for testing your regular expression).

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

Sign in to reply to this post.