realbasic-nug
[Top] [All Lists]

Re: Regex supposed to be this mindbogglingly slow?

To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Regex supposed to be this mindbogglingly slow?
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Mon, 29 Dec 2003 13:36:10 -0600
References: <364D3D18-3A35-11D8-BEED-003065BB0634 at desuetude dot com>
At 2:28 PM -0500 12/29/03, Charles Yeomans wrote:

I've been working on converting an html page into plain text... So I used
regex with a searchpattern of "&nbsp;?" and replacementpattern of " "
[snick]

Shouldn't the search pattern be "&nbsp;" ? I wonder if the inclusion of the "?" metacharacter is causing the slowdown.

Er... what's the RegEx-ing for, then? If you really want to find the string "&nbsp;" then you should be using ReplaceAll[B] (or, if you prefer, InStr[B] and do the replacement yourself). This will be dramatically faster than using RegEx when no RegExing is required.

Cheers,
- Joe

P.S. I love verbing.  Verbing weirds language.

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>