Re: String Manipulation Alternatives to RegEx

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 08:38:41 -0400

Tom,

    The regular expression doesn't time out, rather, the request is timing
out. You have to change the executionTimeout value in the httpRuntime
element in the web.config file to extend the timeout of the request.

    Also, I would seriously consider using something else if you have 2.5
million bytes of text to search through, as using a regular expression is
not the most efficient manner (you have to load the text to be searched on
as a string, and allocating THAT much continuous memory is going to kill
you).

    I would look for third party components that can work on a file, or work
on a stream.

    Hope this helps.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"Tom" <Tom@discussions.microsoft.com> wrote in message 
news:A18DE2D1-BEC6-4AE3-9E16-DB9844F2CCD9@microsoft.com...
>I have string that is 2.5 million bytes long.
>
> I tried using Regular Expressions to look for patterns and replace the
> pattern found with a pre-defined text.  This works great on some computers
> but on some others (win 2K server 1gig of ram) it times out!
>
> So I am looking for an alternative method as I've been told Regular
> Expressions are expensive.
>
> Here is my pattern;
> white spaces followed by a new line (\n) followed by more spaces plus
> a predefined string.
>
> For each occurance, I want to replace this pattern with a predefined 
> string,
> thereby removing all the blank lines, cr lf.
>
>
> Does anyone know of an alternative method to try?
> Can you provide an example?
>
>
> Thanks
>
> Tom
> 


Relevant Pages

  • Re: Emoticon text parser
    ... That is very close to a regular expression already. ... Put it all together, in a string, which requires doubling the escapes: ... We can ease the pain with the COMMENT flag of Pattern; ... as Christian suggested instead of the commenting stuff. ...
    (comp.lang.java.programmer)
  • Re: String Manipulation Alternatives to RegEx
    ... Rather then read the entire string into memory, ... If the next line is not the pattern, write the first line, making the next ... > I tried using Regular Expressions to look for patterns and replace the ... > So I am looking for an alternative method as I've been told Regular ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Automation of comp.lang.javascript FAQ
    ... I cannot see a blanket statement about how string manipulation is "best ... and that is out of place in the FAQ. ... language whereas "Regular Expression" only occurs in descriptions of the ... expression is a pattern of text that consists of ordinary characters ...
    (comp.lang.javascript)
  • Re: RegExp irregularity in JScript
    ... of characters in the string is at ... All three strings match if the pattern is "."; ... the pattern as a submatch ") the entire string is returned, ... This looks like a bug in Microsoft's regular expression implementation (it ...
    (microsoft.public.scripting.jscript)
  • java regex help
    ... For ex: if the String is ... after the pattern matching ... I think my regular expression pattern might be ...
    (comp.lang.java.softwaretools)