I need to find a regular expression in Python. My text string is:

2007-10-12,163.01,167.28,161.80,167.25

I want to extract only the last part: 167.25 (end of line part)

I tried using
regex="(?=[,].+?(?=[\\n]))"
but it did not work. What will be the answer?

Thanks!

Use string.split() instead and split on the commas. Python has a csv module (comma separated variables), but it looks like that would be overkill here.

commented: I agree +13
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.