Extract all words before a text containing certain two separate words


I have some text strings such as:

1 32-Page Booklet $12.00Page 2 of 10
2 Apple iPhone 6 $100.00Page 1 of 3 Price List
3 Page Turner $20.00Page 12 of 13

I like to remove all words after a line containing “Page * of”:

1 32-Page Booklet $12.00
2 Apple iPhone 6 $100.00
3 Page Turner $20.00

Each line contains both page number and total number of pages, which vary with each line.

Is there any way to extract the exact text I need??

Thanks in Advance :slight_smile:

Main.xaml (7.4 KB)

Hi @anna100

Try this regex solution on your input string.

Use an assign activity for that:
yourInputString = System.Text.RegularExpressions.Regex.Replace(yourInputString,"Page \d+ of .+","")

See it work here.



Use this Regular Expression



1 Like

It worked! Thanks for your prompt reply :grin: