Krithi1
1
I have a PDF. I am reading PDF and storing to a variable.
Then I need to extract a string from a particular word(Eg: “Name:” ) to the end of the line. How can I do that?
Name: Rob Hines
Name: There is a dog walking on the street
I have to extract the entire text next to Name: till the end of the line
I tried the following but it’s throwing error. "Compiler error…Expression expected)
System.Text.RegularExpression.Regex.Match(?<=(e-name):\s).*)
You need to pass your expression as a string:
System.Text.RegularExpression.Regex.Match(“?<=(e-name):\s).*”)
I tried this too and it says “Compiler error” …Reference to a non-shared member requires an object reference
I’m sorry!
You need to pass both your expression and the string you want to use that regex expression on.
System.Text.RegularExpression.Regex.Match(“your text”, “your regex expression”)
It’s all explained in the link in my first post
Now it says "Cannot assign from type "system.Text.RegularExpression.Match’ to type “System.string” in Assign activity
Can you please provide me the entire expression?
System.Text.RegularExpression.Regex.Match(pdfOutput, “?<=(e-name):\s).*”)
System.Text.RegularExpression.Regex.Match(pdfOutput, “(?<=Name:\s).*”).Value
Krithi1
10
This is not giving me anything. its giving empty value.
System.Text.RegularExpression.Regex.Match(pdfOutput, “(?<=(e-name):\s).*”)
are there open and close brackets next to e-name causing any problems?
it is “(e-name):” not “e-name:”
Try this instead:
System.Text.RegularExpression.Regex.Match(pdfOutput, “(?<=\(e-name\):\s).*”)
1 Like
Krithi1
12
its now throws this exception -
Assign: parsing “(?<=(e-name\):\s).*” - Not enough )'s
Krithi1
14
thank you soo much, it worked.