  | | | Trimming strings | Trimming strings 2004-04-02 - By Jerry Gamache
Back The problem is definitely to know exactly what kind of regular expression jscript supports. There are many flavors: http://www.greenend.org.uk/rjk/2002 /06/regexp.html That site has a pretty good tutorial. It also includes a RegExp test web page that allows testing expressions interactively: http://www.regular-expressions.info/javascript.html If you like solid paper, this book might help: http://www.oreilly.com/catalog/regex2/
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of Bradley Gabe Posted At: Friday, April 02, 2004 2:30 PM Posted To: xsi Conversation: [Script] Trimming strings Subject: Re: [Script] Trimming strings
Speaking of regular expressions, can anyone recommend good training materials or websites for these?
I'm starting to use them more and more as they are wicked fast compared to the built in jscript String object methods.
-Brad
//function get filesnamepadframenumberextension
//this could be simpler in a line, but seperated for clarity
var string = "myfilename.0001.jpg"
logmessage (string);
//eg for name
var mynameexp = new RegExp(/\w+/)
var result = string.match(mynameexp)
logmessage (result);
//eg for pad
var mynumexp = new RegExp(/\d{4}/)
var result = string.match(mynumexp)
logmessage (result);
//eg for extension
var result = string.match(/\w+$/)
logmessage (result);
Filesystemobject also has methods for extension etc.
-- ---- ---- ---- ---- ---- --
http://www.grahamdclark.com
TD in circulation
-- --Original Message-- --
From: owner-xsi@(protected)
[ mailto:owner-xsi@(protected)] On Behalf Of Bernard Lebel
Sent: April 2, 2004 3:46 PM
To: XSI@(protected)
Subject: [Script] Trimming strings
Hello,
Is there are way to trim an string? For instance, I'm getting
a file name. I
would like to compare this name with other file names, but without the
padding and extension (basically to check if there are sequences of
different name in the same folder). The problem is that when
you get the
file name of a file through FileSystemObject, you get the padding and
extensions as well.
Thanks for any info
Bernard
---
Unsubscribe? Mail Majordomo@(protected) with the following
text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi
--
Bradley R. Gabe
Industrial Light & Magic
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <TITLE></TITLE>
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD> <BODY> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2>The problem is definitely to know exactly what kind of regular expression jscript supports. There are many flavors: <A href="http://www.greenend.org.uk/rjk/2002/06/regexp.html">http://www.greenend .org.uk/rjk/2002/06/regexp.html</A> </FONT></SPAN></DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2></FONT></SPAN><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2></FONT></SPAN> </DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2>That site has a pretty good tutorial. It also includes a RegExp test web page that allows testing expressions interactively:</FONT></SPAN></DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2><A href="http://www.regular-expressions.info/javascript.html">http://www.regular -expressions.info/javascript.html</A></FONT></SPAN></DIV></FONT></SPAN></DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2></FONT></SPAN> </DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2>If you like solid paper, this book might help:</FONT></SPAN></DIV> <DIV><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2><A href="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog /regex2/</A></FONT></SPAN></DIV> <DIV><SPAN class=857144219-02042004></SPAN><SPAN class=857144219-02042004></SPAN><SPAN class=857144219-02042004><FONT face="Comic Sans MS" color=#008080 size=2></FONT></SPAN> </DIV> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> owner-xsi@(protected) [mailto:owner-xsi@(protected)]<B>On Behalf Of </B>Bradley Gabe<BR><B>Posted At:</B> Friday, April 02, 2004 2:30 PM<BR><B>Posted To:</B> xsi<BR><B>Conversation:</B> [Script] Trimming strings<BR><B>Subject:</B> Re: [Script] Trimming strings<BR><BR></FONT></DIV>Speaking of regular expressions , can anyone recommend good training materials or websites for these?<BR><BR>I 'm starting to use them more and more as they are wicked fast compared to the built in jscript String object methods.<BR><BR>-Brad<BR><BR> <BLOCKQUOTE cite=mid00a401c418f2$ec5ac360$1501a8c0@(protected) type="cite"><PRE wrap="">//function get filesnamepadframenumberextension //this could be simpler in a line, but seperated for clarity var string = "myfilename.0001.jpg" logmessage (string); //eg for name var mynameexp = new RegExp(/\w+/) var result = string.match(mynameexp) logmessage (result); //eg for pad var mynumexp = new RegExp(/\d{4}/) var result = string.match(mynumexp) logmessage (result); //eg for extension var result = string.match(/\w+$/) logmessage (result);
Filesystemobject also has methods for extension etc. -- ---- ---- ---- ---- ---- -- <A class=moz-txt-link-freetext href="http://www.grahamdclark.com">http://www .grahamdclark.com</A> TD in circulation
</PRE> <BLOCKQUOTE type="cite"><PRE wrap="">-- --Original Message-- -- From: <A class=moz-txt-link-abbreviated href="mailto:owner-xsi@(protected)" >owner-xsi@(protected)</A> [<A class=moz-txt-link-freetext href="mailto:owner-xsi@(protected)">mailto :owner-xsi@(protected)</A>] On Behalf Of Bernard Lebel Sent: April 2, 2004 3:46 PM To: <A class=moz-txt-link-abbreviated href="mailto:XSI@(protected)">XSI @(protected)</A> Subject: [Script] Trimming strings
Hello,
Is there are way to trim an string? For instance, I'm getting a file name. I would like to compare this name with other file names, but without the padding and extension (basically to check if there are sequences of different name in the same folder). The problem is that when you get the file name of a file through FileSystemObject, you get the padding and extensions as well.
Thanks for any info Bernard --- Unsubscribe? Mail <A class=moz-txt-link-abbreviated href="mailto:Majordomo @(protected)">Majordomo@(protected)</A> with the following text in body: unsubscribe xsi
</PRE></BLOCKQUOTE><PRE wrap=""><!---->
--- Unsubscribe? Mail <A class=moz-txt-link-abbreviated href="mailto:Majordomo @(protected)">Majordomo@(protected)</A> with the following text in body: unsubscribe xsi
</PRE></BLOCKQUOTE><BR><PRE class=moz-signature cols="72">-- Bradley R. Gabe Industrial Light & Magic </PRE></BLOCKQUOTE></BODY></HTML>
|
|
 |