Re: how to split a string using ,fixed character length, variable text delimmiter



This group is amazing. Thankyou both very much, i'm going to explore
them both now.

Oliver Sturm wrote:

Hello,

DODE86DODE86SZDO010144

So I guess what I am trying to do now is split the string, every time a
a string in encountered that is at least 20 characters long, is alpha
numeric, and has the first two letters repeated initself at least two
other times.

Yes, well... you could try using a regular expression such as this:

[ ]([A-Z][A-Z])([A-Z0-9]+)(\1)([A-Z0-9]+)(\1)([A-Z0-9]+)[ ]

(This could also be simplified a bit.)
This does evaluate the double repetition of the initial two characters,
but it can't check the maximum length of the string at the same time. If
you'd just be searching the text in question for occurrences of the
expression, you could easily write an additional check in code, to find
out whether any given string has the correct maximum length. But if you're
using this expression in a Split() call, you couldn't do that...

Personally I would probably still use an expression such as this, to
search for that is, and do the splitting myself. If you can't do the
splitting fully automatically, you'll have to do it yourself in any case -
and using a regular expression to do the delimiter searching seems a
better option to me than coding up the search in C#.



Oliver Sturm
--
http://www.sturmnet.org/blog

.



Relevant Pages

  • Re: partial / wildcard string match in in and list.index()
    ... > to exact matching. ... There is a regular expression library, aptly called 're', for non-exact ... The standard string methods only do exact searching likely because there ...
    (comp.lang.python)
  • Re: Question about Sun JAVAC
    ... >> searching a directory and all subdirectories. ... Finding a string within a file is linear in the length of the file unless ... using an "open" version of grep. ... Regular expression were designed so that you do not need messy stuff ...
    (comp.programming)
  • Re: how to split a string using ,fixed character length, variable text delimmiter
    ... a string in encountered that is at least 20 characters long, ... This does evaluate the double repetition of the initial two characters, but it can't check the maximum length of the string at the same time. ... If you'd just be searching the text in question for occurrences of the expression, you could easily write an additional check in code, to find out whether any given string has the correct maximum length. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Get regular expression
    ... own tree structure. ... Expression compares a string character-by character, ... regular expression solution, which was about as close as one could get to ... the structure of the hierarchy can be inferred by using ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Get regular expression
    ... regular expression solution, which was about as close as one could get to ... first string. ... explode "ABLATION" and see subnodes of "ENDOMETRIAL ... "Heart 27.33/2" ...
    (microsoft.public.dotnet.languages.csharp)

Loading