  | | | Trimming strings | Trimming strings 2004-04-05 - By Graham D Clark
Back Hey Kim, I found some dedicated pattern matching books but nothing by O'reilly. Which is the very good one? Thanks Jerry and Rick for the links. I just got into regex last week end, inspiring lots netview page scripts. For other regex enthusiasts: http://www.regexlib.com/DisplayPatterns.aspx PS Ed just asked why I couldn't go to the other side of the building to reply, but email is easier, using a North American keyboard, Softimage is designed so that I can come into work and leave my left hand fingers and thumb on the zxcv and space keys respectively and not even lift my left wrist all day. Sadly I must lift my right hand a little to move my mouse around but am expecting improvement in ergonomics in the coming years to rectify this inconvienience. -- ---- ---- ---- ---- ---- -- http://www.grahamdclark.com <http://www.grahamdclark.com/> TD in circulation
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of kim aldis Sent: April 3, 2004 7:01 AM To: XSI@(protected) Subject: RE: [Script] Trimming strings
there's one dedicated purely to pattern matching. It's very good. Brad, you're just a speed freak, aren't yuo.
__ __
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Robert Moodie Sent: 02 April 2004 21:07 To: XSI@(protected) Subject: Re: [Script] Trimming strings
Do you have the O'Reilly books? I find them good. We have them on-line here
-- -- Original Message -- -- From: Bradley Gabe <mailto:bgabe@(protected)> To: XSI@(protected) Sent: Friday, April 02, 2004 2:30 PM 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
file://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=us-ascii"> <TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><SPAN class=912313611-05042004><FONT face=Arial color=#0000ff size=2>Hey Kim, I found some dedicated pattern matching books but nothing by O'reilly. Which is the very good one?</FONT></SPAN></DIV> <DIV><SPAN class=912313611-05042004><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN class=912313611-05042004><FONT face=Arial color=#0000ff size=2><SPAN class=912313611-05042004>Thanks Jerry and Rick for the links.</SPAN></FONT></SPAN></DIV> <DIV><SPAN class=912313611-05042004><FONT face=Arial color=#0000ff size=2>I just got into regex last week end, inspiring lots netview page scripts.</FONT></SPAN></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=912313611-05042004>For other regex enthusiasts:</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=912313611-05042004><A href="http://www.regexlib.com/DisplayPatterns.aspx">http://www.regexlib.com /DisplayPatterns.aspx</A></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=912313611-05042004></SPAN></FONT> </DIV> <DIV><FONT face=Arial><SPAN class=912313611-05042004><SPAN id=dgRegexp__ctl10_regular_expression><FONT face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN><FONT color=#0000ff><FONT size=2><SPAN class=912313611-05042004>PS </SPAN>Ed just asked why I couldn't go to the other side of the buildi<SPAN class=912313611-05042004>ng</SPAN> to reply, but<SPAN class=912313611-05042004> email is easier,</SPAN><SPAN class=912313611-05042004> using a North American keyboard, Softimage is designed so that I can come into work and leave my left hand fingers and thumb on the zxcv and space keys respectively and not even lift my left wrist all day. Sadly I must lift my right hand a little to move my mouse around but am expecting improvement in ergonomics in the coming years to rectify this inconvienience.</SPAN></FONT></FONT></SPAN></SPAN></FONT></DIV> <DIV><FONT face="Times New Roman">-- ---- ---- ---- ---- ---- --</FONT> <BR><FONT face="Times New Roman"><A href="http://www.grahamdclark.com/">http://www.grahamdclark.com</A></FONT> <BR><FONT face="Times New Roman">TD<SPAN lang=en-ca></SPAN></FONT><SPAN lang=en-ca> <FONT face="Times New Roman">in circulation</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN> </DIV> <BLOCKQUOTE dir=ltr style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px"> <DIV></DIV> <DIV class=OutlookMessageHeader lang=en-us 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>kim aldis<BR><B>Sent:</B> April 3, 2004 7:01 AM<BR><B>To:</B> XSI@(protected)<BR><B>Subject:</B> RE: [Script] Trimming strings<BR><BR></FONT></DIV> <DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN class=906575906-03042004>there's one dedicated purely to pattern matching. It's very good.</SPAN></FONT></DIV> <DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN class=906575906-03042004></SPAN></FONT> </DIV> <DIV dir=ltr align=left><FONT face=Arial color=#008080 size=2><SPAN class=906575906-03042004>Brad, you're just a speed freak, aren't yuo.</SPAN></FONT></DIV><BR> <BLOCKQUOTE dir=ltr style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #008080 2px solid; MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> owner-xsi@(protected) [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>Robert Moodie<BR><B>Sent:</B> 02 April 2004 21:07<BR><B>To:</B> XSI@(protected)<BR><B>Subject:</B> Re: [Script] Trimming strings<BR></FONT><BR></DIV> <DIV></DIV> <DIV><FONT face=Arial size=2>Do you have the O'Reilly books? I find them good. We have them on-line here</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT : #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From: </B> <A title=bgabe@(protected) href="mailto:bgabe@(protected)">Bradley Gabe</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=XSI@(protected) href="mailto:XSI@(protected)">XSI@(protected)</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, April 02, 2004 2:30 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Script] Trimming strings</DIV> <DIV><BR></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=""><A href="file://function">file://function</A> 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></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
|
|
 |