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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thankyou developer x, i'm not getting the desired result. Then i
realised i shouldn't be using @ as that will just negate the escape
characters.

The regex doesn't like \1 any suggestions what this should be changed
to?

Thanks,

Gary-

DeveloperX wrote:

try
string[] matches = r.Split(filecontents); Assuming filecontents is the
text we're searching.

garyusenet@xxxxxxxxx wrote:
I am trying to use the regular expression that Oliver kindly provided
as a starting point.
filecontents is a string that contains my file contents. But i cant get
this to work. I added the @ in as i was getting an error that it didn't
recognise the escape sequence, but it still isn't working. How can i
fix this? Thankyou.

Im getting an error at Regex.Split(...)

Regex r = new Regex(@"[
]([A-Z][A-Z])([A-Z0-9]+)(\1)([A-Z0-9]+)(\1)([A-Z0-9]+)[ ]");
Regex.Split(filecontents, r);

MessageBox.Show(filecontents.Length.ToString());

Thankyou

.



Relevant Pages

  • Re: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?
    ... but Regex uses this to define a ... It seems that if you don't escape it, ... Even if there is a problem with the meta characters, ...
    (php.general)
  • Re: how to extract part of HTML page
    ... hassle to rewrite it to use strpos() and substr, ... and strlento be much easier to understand than a regex. ... TBH, neither would be that bad a ballache. ... and that will be different from developer to developer. ...
    (comp.lang.php)
  • Re: how to extract part of HTML page
    ... And I find strpos() ... and strlento be much easier to understand than a regex. ... TBH, neither would be that bad a ballache. ... and that will be different from developer to developer. ...
    (comp.lang.php)
  • Re: Regular Expression reserved letters
    ... The problem ist, that e.g.),,are reserved words in regex. ... them in filter expressions i have to escape them with \). ... If, on the other hand, you have a portion of an expresion that must be ... documentation here: <http://java.sun.com/j2se/1.4.2/docs/api/java/util/ ...
    (comp.lang.java.programmer)
  • Re: Confusion about String.matches method
    ... If you wanted a regex you want the two chars \ and n in the regex ... string. ... However, if you do that, Java will think \ is an escape char, so you ... How long did it take after the car was invented before owners understood ...
    (comp.lang.java.programmer)