Hi,
From the below string i need to find the Value of EMCF with Substring. Can anyone help??
name="EMCF"><link rel="field" href="awdServer/awd/services/v1/fields/EMCF" type="application/vnd.dsttechnologies.awd+xml"/>Test Value
href="awdServer/awd/services/v1/fields/AMTV" type="application/vnd.dsttechnologies.awd+xml"/>0.0000<fieldValue description="Tax ID" name="SSNO"><link rel="field"
Thanks
Hi @Sonam_Nagpal ,
Are you trying to match EMCF exactly? You could use a Regex pattern to match that:
[EMCF]{4}
Or if you are trying to match the 4-character upper case codes, you can do that with Regex too:
[A-Z]{4}
Edit: If substring isn’t a necessity then this would be an alternative to that. If substring is necessary then @fernando_zuluaga ’s solution would work, trusting the format doesn’t change
1 Like
hi @Sonam_Nagpal
if your position will never change you can try with that
and correct your expresion with the double " like that
str_Path = “name=”“EMCF”“><link rel=”“field”" href=““awdServer/awd/services/v1/fields/EMCF”” type=““application/vnd.dsttechnologies.awd+xml””/>Test Value href=““awdServer/awd/services/v1/fields/AMTV”” type=““application/vnd.dsttechnologies.awd+xml””/>0.0000<fieldValue description=““Tax ID”” name=““SSNO””><link rel=““ield””"
best regards
In which i need result “Test value” when i will check for EMCF.
lepumin
(JosĂ© L. RodrĂguez)
March 16, 2022, 7:42pm
5
Try it:
myValue = System.Text.RegularExpressions.Regex.Match(myTxt,"name=""EMCF"">.+>(.+)<\/value>").Groups(1).ToString
(try, because you are showing a parsed text with double quotes scaped by slash)
myValue = System.Text.RegularExpressions.Regex.Match(myTxt,"name=\""EMCF\"">.+>(.+)<\/value>").Groups(1).ToString
@lepumin
Thanks for your help, The RegularExpression you have shared giving me the last value “123456789” in my data. But i need result as “Test Value”. When i will check for EMCF i need first value
Can u plz check??
Thanks
carmen
March 17, 2022, 4:05am
7
Hi @Sonam_Nagpal
What are you trying to do? I can see your first question was aswered. If you need more help you should be more especific when you are asking for help.
Try this…
let us know if that help