  | | | VBS - Fixing Text | VBS - Fixing Text 2004-03-02 - By Nick Petit
Back Cheers Kim, I'll give the Jscript wrapping a shot... :)
Nick Petit Lead 3D/TD F U S E D D D @ M R P P P 20 Thistlethwaite St South Melbourne 3205 VIC Australia
http://www.mrppp.com.au -- -- Original Message -- -- From: kim aldis To: XSI@(protected) Sent: Tuesday, March 02, 2004 2:43 AM Subject: RE: [Script] VBS - Fixing Text
sorry, didn't see the vbs thing. I find js patterns a lot better than vbs; closer to the original Perl. You could always wrap a js script into a command.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of kim aldis Sent: 01 March 2004 13:42 To: XSI@(protected) Subject: RE: [Script] VBS - Fixing Text
the jscript string replace, yeah? Guessing massively, you have your caret inside the square brackets which I'm sure won't work.
s = s.replace( /^[0-9]+/, "_" ); s = s.replace( /^w+/, "_" );
combining the digit and space thing into one you may have to work at.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Nick Petit Sent: 01 March 2004 10:39 To: XSI Subject: [Script] VBS - Fixing Text
Hiya,
I'm having a slight brain fart at the moment and can't seem to figure out how to get this going... I'm retrieving text from user input (from a text file or whatever) and I don't want to limit the user to have to watch out for his spelling by having to not put in spaces, numbers at the head of the word nor special characters... How do I strip a string of all the numbers, spaces and special characters and replace them with an underscore? The replace function won't accept [^a-z]... I've managed to get the script going another way but I'm now curious as to how to do the above...
Cheers! Nick.
Nick Petit Lead 3D/TD F U S E D D D @ M R P P P 20 Thistlethwaite St South Melbourne 3205 VIC Australia
http://www.mrppp.com.au <!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"> <META content="MSHTML 6.00.2800.1106" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Cheers Kim, I'll give the Jscript wrapping a shot... :)</FONT></DIV> <DIV> <DIV> </DIV> <DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2><FONT color=#808080>Nick Petit<BR></FONT><FONT color=#800000><FONT color=#808080>Lead 3D/TD</FONT><BR><STRONG>F U S E D D D @ M R P P P<BR></STRONG></FONT><FONT color=#808080 size=1 >20 Thistlethwaite St<BR>South Melbourne<BR>3205 VIC<BR>Australia</FONT></FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2><A href="http://www.mrppp.com.au">http://www.mrppp.com.au</A></FONT></DIV></DIV>< /DIV> <BLOCKQUOTE dir=ltr 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=kim@(protected) href="mailto:kim@(protected)">kim aldis</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> Tuesday, March 02, 2004 2:43 AM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Script] VBS - Fixing Text</DIV> <DIV><BR></DIV> <DIV dir=ltr align=left><SPAN class=312434215-01032004><FONT face=Arial color=#008080 size=2>sorry, didn't see the vbs thing. I find js patterns a lot better than vbs; closer to the original Perl. You could always wrap a js script into a command.</FONT></SPAN></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> <A href="mailto:owner-xsi@(protected)">owner-xsi@(protected)</A> [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>kim aldis<BR><B>Sent:</B> 01 March 2004 13:42<BR><B>To:</B> <A href="mailto:XSI@(protected)">XSI@(protected)</A><BR><B>Subject:</B> RE : [Script] VBS - Fixing Text<BR></FONT><BR></DIV> <DIV></DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2>the jscript string replace, yeah? Guessing massively, you have your caret inside the square brackets which I'm sure won't work.</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2></FONT></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2>s = s.replace( /^[0-9]+/, "_" ); </FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2>s = s.replace( /^w+/, "_" );</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2></FONT></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=171033913-01032004><FONT face=Arial color=#008080 size=2>combining the digit and space thing into one you may have to work at.</FONT></SPAN></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>Nick Petit<BR><B>Sent:</B> 01 March 2004 10:39<BR><B>To:</B> XSI<BR><B>Subject:</B> [Script] VBS - Fixing Text<BR></FONT><BR></DIV> <DIV></DIV> <DIV><FONT face=Arial size=2>Hiya, </FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I'm having a slight brain fart at the moment and can't seem to figure out how to get this going...</FONT></DIV> <DIV><FONT face=Arial size=2>I'm retrieving text from user input (from a text file or whatever) and I don't want to limit the user to have to watch out for his spelling by having to not put in spaces, numbers at the head of the word nor special characters...</FONT></DIV> <DIV><FONT face=Arial size=2>How do I strip a string of all the numbers, spaces and special characters and replace them with an underscore? </FONT></DIV> <DIV><FONT face=Arial size=2>The replace function won't accept [^a-z]... </FONT></DIV> <DIV><FONT face=Arial size=2>I've managed to get the script going another way but I'm now curious as to how to do the above... </FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Cheers!</FONT></DIV> <DIV><FONT face=Arial size=2>Nick.</FONT></DIV> <DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2><FONT color=#808080>Nick Petit<BR></FONT><FONT color=#800000><FONT color=#808080>Lead 3D/TD</FONT><BR><STRONG>F U S E D D D @ M R P P P<BR></STRONG></FONT><FONT color=#808080 size=1>20 Thistlethwaite St<BR>South Melbourne<BR>3205 VIC<BR>Australia</FONT></FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2><A href="http://www.mrppp.com.au">http://www.mrppp.com.au</A></FONT></DIV>< /DIV></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
|
|
 |