ScriptSpot home

Forum topic · General Scripting

Selection by regular expression.

By Alex · 2013-05-01

Description

Hey!

I need help for script writting , I'm bad at scripting and I need a simple script.

This script is selecting all the mesh have the suffix "_2"

Just this ...

Sorry for my bad english :)

Thanks for your help :)

Comments (9)
Alex

---

Alex

--

Branko Živković

try this one


select (for o in objects where matchPattern o.name pattern:"*_2*" collect o)

Reply to Alex
Branko Živković

:)

Then post at least your list of object names to see with what you playing

Reply to Alex
Branko Živković

:)

Man you are using "2_" not "_2". Just change pattern, also there is a group

Stupid error :)

Yeah !!!!! :p It works ! Stupid error sorry :p

Thanks you for your help barigazy !!!!! :)

Have a nice day !

Regards,

Kasimashi

Reply to Branko Živković
Branko Živković

about patterns

If you use "*_2" as pattern then you will be able to select all objects with
name where last two characters matching pattern like "Mash_2", "Box_2" etc.
But if you use "*_2*" then you can select also "Mash_200", "Mash_25", "Mash_20_18".