mark smith wrote: i search a way to split a string in two area...
one for string and another for number...

example

aa34
come
aa 34

z342
come

z342

i tried with regex without success

What did you try?

I see that in your first example, the result has a space between the letters and the number, but in your second example, the result does not.

For a regular expression to work, the first thing to do is to define clearly what is regular about it. Is your String always in the format of n-letters and m-numbers without spaces, gaps or white space? If you can define the pre-parse and post-parse formats clearly, we can help you towards a workable solution.

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 251

posted May 08, 2010 12:05:08

0

my error...

aa34
come
aa 34

zt42
come
zt 42

i don't know the number of letter and the number of digit...

the only thing i know it's that begin by a letter and end by a nubmer

i tried to find the first number and to split before this position... a regex seem a better solution

pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561

posted May 08, 2010 12:21:20

0

mark smith wrote: i don't know the number of letter and the number of digit...
the only thing i know it's that begin by a letter and end by a nubmer
i tried to find the first number and to split before this position... a regex seem a better solution

I'm no regex expert, but perhaps using look-ahead and look-behind for a non-digit word character next to a digit character is what you need. For e.g.,

mark smith wrote: i don't know the number of letter and the number of digit...
the only thing i know it's that begin by a letter and end by a nubmer
i tried to find the first number and to split before this position... a regex seem a better solution

I'm no regex expert, but perhaps using look-ahead and look-behind for a non-digit word character next to a digit character is what you need. For e.g.,