2

This is what I have, but I know it is incorrect and I'm not sure what to change

print '0.4066145E-07-0.3677403'.split('E+(\-\d{2})', 1 )

I'm looking to get:

['0.4066145E-07','-0.3677403']

or more generally I just want to split up these numbers.

['######E-##','#########']

Also what if there is an exponent in the second number?

['######E-##','#######E-##']
2
  • Just for curiosity...are you here trying to extract scientific notation of a floating numbers in your strings? Commented Jul 16, 2015 at 18:45
  • I just had output that was running into one another and therefore creating errors. Commented Jul 17, 2015 at 15:13

1 Answer 1

2

You can try with:

(?<=E-\d\d)(?=-\d+.)

DEMO

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Works perfectly and that site you linked to is great. Definitely going to be using that more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.