Hello
I was trying to parse a number from string as shown below. Would you please
let me know if there is easy way to get the number after a specific string
? please note that the string can be variable(different)
goal is to specify search string and put out exact number with out any
text before and after the number.
The current program shown below has two faults
1. on line 10, I have to manually enter starting word but cannot put a
variable as shown below
c = match(r"$srchStr[\w|\w %s%f%f|.|:|+]*", b[srchInd])
2. I have to only get a number, that means anything in front and behind
that number should be stripped off
exString = "Exact number 390 \n Exact qty: +200 people \n Starting
number: 5 now 16.5A_C"
srchStr ="Exact qty:"
b= split(exString,"\n") # put each line to an array form
#find index of excact string match
for i in 1:length(b)
if contains(b[i], srchStr) == true
srchInd = i
end
end
c = match(r"$srchStr[\w|\w %s%f%f|.|:|+]*", b[srchInd])
d=replace(c.match, srchStr,"")
print(d)