Re: String manipulation in Webcatalog
This WebDNA talk-list message is from 2001
It keeps the original formatting.
numero = 39070
interpreted = N
texte = Laeg Ent. wrote:> > [grep> search=0+([0-9]+)0+&replace=\1][likenumber][/grep]> > this just gets rid of the initial zeros......> > 0010200 results in 10200> Sorry, the ([0-9]+) is too greedy (snagging all trailing zeros). Ifyou were using Perl, you could use this instead: [grep search=0+([0-9]+?)0+&replace=\1][likenumber][/grep]which would be the nongreedy version of 1 or more. In this case, youwill have to pick off the initial zeros then strip the trailingzeros. Do this to strip the trailing zeros: [grep search=([1-9]+)0+$&replace=\1][likenumber][/grep]which is to say find any sequence numbers that do not include 0 andare followed to the end of line by only zeros and replace it by justthe number.John -- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4720 Boston WayLanham, MD 20706301-459-3366 x.5010fax 301-429-5747-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Laeg Ent. wrote:> > [grep> search=0+([0-9]+)0+&replace=\1][likenumber][/grep]> > this just gets rid of the initial zeros......> > 0010200 results in 10200> Sorry, the ([0-9]+) is too greedy (snagging all trailing zeros). Ifyou were using Perl, you could use this instead: [grep search=0+([0-9]+?)0+&replace=\1][likenumber][/grep]which would be the nongreedy version of 1 or more. In this case, youwill have to pick off the initial zeros then strip the trailingzeros. Do this to strip the trailing zeros: [grep search=([1-9]+)0+$&replace=\1][likenumber][/grep]which is to say find any sequence numbers that do not include 0 andare followed to the end of line by only zeros and replace it by justthe number.John -- John PeacockDirector of Information Research and TechnologyRowman & Littlefield Publishing Group4720 Boston WayLanham, MD 20706301-459-3366 x.5010fax 301-429-5747-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
John Peacock
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
carriage returns in data (1997)
Not reading code (1997)
One per customer (2000)
Beta (?) version of WebCatalog 2.1 (1998)
WebCatb15 Mac CGI -- [purchase] (1997)
[WebDNA] Two scripts fail on 6.0 but not on 7.x ... ? (2012)
404 error -- but wc code executes... (2001)
Date search - yes or no (1997)
Bug or syntax error on my part? (1997)
Search in 2 or more catalogs (1997)
Cart -> Date and Time (2004)
Upload Progress Bar (2003)
[WebDNA] PayPal Integration (2017)
Problem (1997)
Is this google friendly? (2003)
Newbie problem blah blah blah (1997)
Many $WebCat.exe processes (1998)
WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997)
Re1000001: Setting up shop (1997)
BUG ? Running on Empty (1999)