Using Regex and take a particular value


#1

Hi All,

Can you please help me out in solving the below hurdle.
I want to use regex expression in my workflow for the particular type.

Steps to Reproduce:

  1. Go to https://regex101.com/
  2. Place the below text in “Test String” space provided.

Actual Result : I need only 1,2,3 and 4 from the text mentioned below.

text to be inserted in Test String:
16-March-2018
17-march-2018
1,000
1,000
1,000
3,000
6,000 1
2
3
4
RPA
18-march-2018
19-march-2018
20-march-2018


#2

@ManojGL
First Split your string and and join it to a single string
and join string with two spaces
strb=String.Join(" ",stra.Split({Environment.NewLine},stringSplitOptions.None))

System.Text.RegularExpression.Regex.Matches(strb,"\s\d\s")

Regards,
Mahesh


#3

@ManojGL, Check this Regex Pattern

\b\d(?!.)\b

\b - Word Boundary
\d - Digit
?! - Negative Lookahead 
(?!.) - Consider values that dont followed by any characters other than newLine

Regards,
Dom :slight_smile:


#4

Thanks @Dominic , it is working fine now.
I checked for some other flows too.

Regards
MG :slight_smile: