Regex to extract checkbox selected data

I’m extracting an employee form PDF using regex but i could not able to extract the checkbox selected data.
I just want to extract the value “Single” if Single is checked or the value “Married” if Married is checked.
For Example :
Marital Status: Single ☐ Married ☒

Here Married is checked so i want to extract “Married” using regex. Is it Possible with regex? Please help with this one.

If you are sure that you are getting only these checkboxes in String, then you check any one of them:
"Marital Status: Single ☐ Married ☒".Split(New String(){"Single"},StringSplitOptions.None)(1).Split(New String(){"Married"},StringSplitOptions.None)(0).Trim.Equals("☐").ToString

"Marital Status: Single ☐ Married ☒".Split(New String(){"Married"},StringSplitOptions.None)(1).Trim.Equals("☒").ToString

Hi thanks for the reply. But here im trying to extract it from a pdf file based on a regular expression like first reading the PDF file text and after that using “Matches” activity im extracting the value. So is it possible to extract the checked data using regex.

Will this regular expression do?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.