Need help trimming the last character in a Function String

Find, replace, find in files, replace in files, regular expressions

Need help trimming the last character in a Function String

Postby steve » Thu May 12, 2005 1:38 pm

In MAXScript functions take the form of either:

fn <name> <param 1> <param 2> ... <param n> =

or

function <name> <param 1> <param 2> ... <param n> =


I've made a function string regular expression that can find them in either format and populate the list without the "fn" or "function". I'd like to keep the trailing = character from appearing too. I haven't been able to figure out how to do that, though.

My regular expression is:

/Function String = "%[ ^t]++^{fn^}^{function^}++ ^(*++^)$"


Additionally, if possible, what would the proper format be to only show the function name (no parameters, no =) in the function list?
steve
Basic User
Basic User
 
Posts: 11
Joined: Mon Jul 18, 2005 11:00 pm

Re: Need help trimming the last character in a Function String

Postby Mofi » Fri May 13, 2005 1:07 am

Try this "%[ ^t]++^{fn^}^{function^}[ ^t]+^([~ ]+^)*="
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Need help trimming the last character in a Function String

Postby steve » Fri May 13, 2005 9:01 am

Thank you, Mofi. That works wonderfully!
steve
Basic User
Basic User
 
Posts: 11
Joined: Mon Jul 18, 2005 11:00 pm


Return to Find/Replace/Regular Expressions