03-05-2009 01:22 PM
Hello everyone,
I am working on a project that require me to seperate the following examples:
+0,+0.0000+E1,-4.33+E1,-4.222+E1,-6.33+E2,-6.55+E2
What I need is the final four results seperately:
-4.33+E1,
-4.222+E1,
-6.33_E2,
-6.55+E2.
I am totally fresh to regular expression. Any help is well appreciated!
Thanks,
+Kunsheng
Solved! Go to Solution.
03-05-2009 01:41 PM - edited 03-05-2009 01:43 PM
Take a look at the code below. It doesn't make much use of RegEx, but I think it is simpler.
03-05-2009 01:41 PM
Try feeding the string to the Spreadsheet String to Array function with comma (,) as the delimiter and string as the datatype. This should give you an array of strings with each of the values in a different element. Then use an expanded Index Array node to get your last four results. If you need the commas at the end of these strings, you may need to concatenate them back on as the first step above will remove the delimiters.
No regular expressions required.
Lynn
03-05-2009 01:48 PM - edited 03-05-2009 01:48 PM
03-05-2009 03:02 PM - edited 03-05-2009 03:04 PM
What are the rules? I don't see any simple pattern in your example.
Maybe something like this gets you partway there:
03-05-2009 03:17 PM - edited 03-05-2009 03:18 PM
Hi, Kunsheng
Good evening exercise for learning regular expressions...
For example, quick and dirty:
I have strong feeling that something wrong here (I guess in ([0-9]+[1-9]+)), but anyway the code above is just starting point for you.
Andrey.
03-05-2009 03:29 PM - edited 03-05-2009 03:30 PM
Upd:
Or more easy version if strings with zeroes allowed:
03-05-2009 03:30 PM
Awesome! thanks for all of you! I am sorry I didn't mention that clearly enought, but the last one is definitely the solution I need!!
Thanks a lot!
Best,
+Kunsheng
03-05-2009 03:37 PM
Welcome!
But be careful with numbers like this: +0,+0.0000+E1,-4.0330+E1,-4.222+E1,-6.33+E2,-6.55+E2
The code above will skip this number. So, I would recommend to use second solution, and then delete "zero numbers" from array, outside of regular expression.
Andrey.
03-05-2009 04:29 PM