I need to extract "After the US dollar index rose sharply last night, the Asian currency generally weakened today, and the Taiwan dollar also opened lower. ”
from the string below, using split function
“TWD: 31.000~31.150
After the US dollar index rose sharply last night, the Asian currency generally weakened today, and the Taiwan dollar also opened lower.
ZAR: 14.0000~14.1500
The South African rand rose against the dollar on Thursday, hitting a three-month high and rising with other emerging market currencies as the dollar was weighed down by US interest rate cuts. "
However, the part I would like to extract is dynamic, meaning that it changes everyday
Nice! I was struggling a bit with that Regex. Nice work!
if you could tell me, what is the difference between “(?<=TWD: ).+?(\n)” and “(?<=TWD: ).*” I used the second one
See, both will work here.
In (?<=TWD: ).+?(\n) —> +? use to get text between, so, it’ll search for TWD: and get text upto newline (\n). So, basically it is useful when you want to extract text between two words.
Nothing else.