Regular expression to extract first word from sentence

Hi All,

I want to extract the first word from a sentence by using regular expression.

Example - I/p : asdfeghh qwerty hrktjhrtkhrkt
Expected o/p : asdfeghh

Can anyone help me to solve this?

Thanks

HI @rnahasnahasuddin

How about this expression

System.Text.RegularExpressions.Regex.Match(YourString,"^\S+").Tostring

image

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Match(yourString,"\w+").Value

Regards,

Hi @rnahasnahasuddin


^\w+(?=.+html)

Can you all help me with the regular expression to use in Abbyy flexilayout studio

Hi @rnahasnahasuddin

You can directly use a split activity instead as below

Say your string variable is str

Then str.Trim.Split(“ ”,2,StringSplitOptions.None)(0).Trim

This will always give the first work

Cheers

Hi @rnahasnahasuddin

Try ^\S+

Cheers

Kindly check out the document @rnahasnahasuddin

https://help.abbyy.com/en-us/finereader/12/regularexpression/

https://help.abbyy.com/en-us/flexicapture/12/flexilayout_studio/regex_ext/

Regards
Gokul

Can you help me with an example?

Hi @rnahasnahasuddin

Check out this video and docs

Blog