ScriptSpot

Forum topic · General Scripting

Selection by regular expression.

By Kasimashi · 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)

Kasimashi · 2013-05-01

---

Kasimashi · 2013-05-01

--

try this one

barigazy · 2013-05-01


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

Reply

Kasimashi · 2013-05-01

Don't work :(

:)

barigazy · 2013-05-01

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

:)

barigazy · 2013-05-01

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

Stupid error :)

Kasimashi · 2013-05-01

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

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

Have a nice day !

Regards,

Kasimashi

about patterns

barigazy · 2013-05-01

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".