View Full Version : Regular Expressions ... HELP
meta_Nerd 08-30-2006, 12:20 AM http://regular-expressions.com/
http://www.tcl.tk/man/tcl8.5/tutorial/Tcl20.html
I am not sure why I cannot find regular expressions in Max. I can't imagine a scripting language that doesn't have it, but I hope I am wrong. Please someone show me I am wrong... please !!!
I posted some links explaining regExp's in hopes that you guys can benefit from them (if they are in there), as they are Oh-So-Powerfull.
Thanks guys,
Chris
|
|
http://regular-expressions.com/
http://www.tcl.tk/man/tcl8.5/tutorial/Tcl20.html
I am not sure why I cannot find regular expressions in Max. I can't imagine a scripting language that doesn't have it, but I hope I am wrong. Please someone show me I am wrong... please !!!
I posted some links explaining regExp's in hopes that you guys can benefit from them (if they are in there), as they are Oh-So-Powerfull.
Thanks guys,
Chris
Start imagining ;)
There is limited pattern matching for strings (the method is called matchPattern someString pattern:"*somepattern*"), but it is not a full-featured regex implementation. There are enough parsing methods to do what you want in MAXScript though, so this hasn't stopped anyone from coding in Max.
Since MAXScript was developed to work mostly inside of (surprise!) Max, it does not provide some features general scripting languages used at OS shell level provide. At the same time it provides Max-related methods from the field of 3D math and graphics other scripting languages do not necessarily need.
AlpineMan
08-30-2006, 02:23 AM
Just wait until Max 9. Sorry no more hints for today.
Chris J.
Just wait until Max 9. Sorry no more hints for today.
Chris J.
Huh? Really? I must have missed something...
Incidently, a Frantic Films extension which ships with the free Amaretto bridge to NVidia's Gelato renderer provides full regex support. I will investigate what the exact interface name and methods were tomorrow...
meta_Nerd
08-30-2006, 02:57 PM
Thanks for the quick responses.
Looking forward to your post on the extension.
Chris
Thanks for the quick responses.
Looking forward to your post on the extension.
Chris
Ok, the interface is called Frantic and is exposed by the Amaretto plugin which ships (in Beta) with the free Gelato renderer by nVidia.
Interface: Frantic
Properties:
.Version : value : Read
.MetersConversionFactor : float : Read
Methods:
<value>GetLocalBBox <node>Node
<value>GetObjTMAfterWSM <node>Node
<value>GetMaterialIds <mesh>Mesh
<void>ResetProfilers()
<void>EnterProfileSection <value>SectionName
<void>ExitProfileSection <value>SectionName
<void>PrintProfilers <value>Title
<void>WriteProfilersToFile <value>FileName <value>Title
<value>ReplaceSequenceNumber <value>FileName <integer>SequenceNumber
<value>AddSequenceNumber <value>FileName <integer>SequenceNumber
<value>AddBeforeSequenceNumber <value>FileName <value>StringToAdd
<value>LowerCase <value>String
<value>UpperCase <value>String
<value>StrReplace <value>String <value>Pattern <value>Replacement
<value>RegExSearch <value>String <value>RegEx
<value>GetEscapedString <value>String
<integer>GetCRC32 <value>String
<value>GetEnv <value>VariableName
<value>SubstituteEnvVars <value>String
<value>EnvVarToUnix <value>String
<value>EnvVarToDos <value>String
<value>SplitSearchPath <value>SearchPath
<value>FindFileInSearchPath <value>FileName <value>SearchPath
<value>ToUnixStyleSearchPath <value>String
<void>CheckMeshForProblems <mesh>Mesh
<float>GetFaceArea <mesh>Mesh <integer>FaceIndex
<point3>GetVertexInFaceNormal <mesh>Mesh <integer>FaceIndex <integer>VertexSubIndex
<value>RandomPointOnMesh <mesh>Mesh
Examples:
Frantic.RegExSearch "a;lsjaeoi5r" "^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
RESULT:
undefined -- not an email
Frantic.RegExSearch "abc@def.com" "^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
RESULT:
#() -- matches the pattern completely
Frantic.RegExSearch "abc@def.com" "^([a-zA-Z0-9._%-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})$"
RESULT:
#("abc", "def.com") --sub-patterns matched
Frantic.RegExSearch "@abc@def.com" "^([a-zA-Z0-9._%-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})$"
RESULT:
undefined --does not match, since we are checking from beginning ^ to end $
Frantic.RegExSearch "@abc@def.com" "([a-zA-Z0-9._%-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})"
RESULT:
#("abc", "def.com") --this matches, because we don't check from beginning to end
meta_Nerd
08-31-2006, 07:11 AM
Sweeeeet,
I totally appriciate this. You made my fnday.
Chris Reid
CGTalk Moderation
08-31-2006, 07:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.