PDA

View Full Version : Regular Exressions



colkai
11-21-2003, 02:31 PM
Can anyone point me in the direction of some good info for Regular Expressions within LScript.

I have read the patch notes and they refer to the "s~ .. ~" operator, but ther edoesn't seem to be anything in either the user or reference manual on the syntax for regexps and what the relevant bits mean.

For example... taking part of IncSaveObj2.ls

if (filename == s~.+([0-9][0-9]\.lwo$)~)

.. I can determine is probably something to do with numbers in the filename but as to what '.+(' and '\.lwo$)' are supposed to do, I have no help in the docs.
Are the regexps unique to LScript, or is their syntax laid down in a globally accepted form?

faulknermano
11-22-2003, 04:05 AM
it's supposed to be universal. if you have inside lightwave 6, bob hood inserted a single example. i wouldnt recommend buying it just because of that, but if you could somehow borrow a copy from a friend or something?

what exactly did you have in mind to use regular expressions for?

colkai
11-22-2003, 05:54 AM
It's primarily to search for text within filenames as I want to customise the incsaver script for my own personal preferences.

I do have Inside LW6 (and 7.. and power guide. ;) )

but I was looking for a 'definitive' breakdown of the syntax, I was surprised to find the LScript reference makes very little note of it as I would imagine it can be a powerful tool.

faulknermano
11-22-2003, 08:00 PM
Originally posted by colkai
It's primarily to search for text within filenames as I want to customise the incsaver script for my own personal preferences.

I do have Inside LW6 (and 7.. and power guide. ;) )

but I was looking for a 'definitive' breakdown of the syntax, I was surprised to find the LScript reference makes very little note of it as I would imagine it can be a powerful tool.


well, i do believe it is universal (i think either the patch notes or the inside lightwave book mentions that you can find resources for that on the web... never got lucky though). i suppose that is why you dont find that in the references.

however, this is something simple i used to replace text:



searchAndReplace: oName, search, replace
{
exp = regexp(search,replace);
oName ~= exp;
return(oName);
}


other than that maybe a search in google is in order. i remember searching myself but never found what i was looking for.. i guess i was unlucky. ;)

colkai
11-23-2003, 04:43 AM
Originally posted by faulknermano

...other than that maybe a search in google is in order. i remember searching myself but never found what i was looking for.. i guess i was unlucky. ;)

Nah, it's not you. I tried the same thing, na-da, it can be frustrating that when you are looking for something, there are all sorts of sites, but not that are actually relevant ;)