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

Question

Question

Regular Expression - Duplicating at End for Some Reason

asked on October 14, 2021 Show version history

I'm pulling text from a multi-value field from Laserfiche:

Value 1:

1. Text text text:
a. Text text text
b. Text text text
c. Text text text
Text text text

Value 2:

2. Text text text

Value 3:

3. Text text 1995 

Each value is always numbered (1., 2., 3., etc.). I need to eliminate the number in the beginning, plus the period, plus the space. Here's the regular expression I am using:

\d{1,3}\.\s((.|\n)*)

It appears to be successful, however, it is repeating the last character every time (see the bold below):

Value 1:

Text text text:
a. Text text text
b. Text text text
c. Text text text
Text text textt

Value 2:

Text text textt

Value 3:

Text text 19955

Any help eliminating this last character would be fabulous!

0 0

Answer

SELECTED ANSWER
replied on October 14, 2021

Hi Gloria, Try this

(?s)\d{1,3}\.\s(.*)

1 0

Replies

replied on October 14, 2021

By using parentheses twice, your asking for 2 groups of information, or 2 results.

This works fine for example

\d{1,3}\.\s(.+)

It looks like your trying to do an or statement, which should be using brackets, for example

\d{1,3}\.\s([\w\r\n]+)

[\w\r\n] means any word character, any return character, any new line character

0 0
replied on October 14, 2021

No luck.

When I used \d{1,3}\.\s(.+), I only get to see the first line.

When I used \d{1,3}\.\s([\w\r\n]+), I only get the first word after the 1.

0 0
replied on October 14, 2021

Try this to capture the space character as well

\d{1,3}\.\s([ \w\r\n]+)

You must put every character you want to capture inside of the brackets. I don't think the bracket OR notation accepts the general . character (not sure why)

0 0
replied on October 14, 2021

Nope.

0 0
SELECTED ANSWER
replied on October 14, 2021

Hi Gloria, Try this

(?s)\d{1,3}\.\s(.*)

1 0
replied on October 15, 2021

Success! Thank you for everyone's assistance.

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

Sign in to reply to this post.