Hi Alberto, Thank you for the quick response! I tried your method but it returns a lot of None as results, although it might just be me using not correctly, I'm not super familiar with this. What I wanted is to check if objects with those specified naming conventions exist, and if so select them, otherwise return the error message.
Cheers! On Thursday, February 21, 2019 at 1:11:35 PM UTC-8, Alberto Sierra Lozano wrote: > > I was thinking about something like: > > import re > > regex = re.compile(r"(.*[lL]_\w*_[cntlCNTL]{4})") > all_elements = cmds.ls() > for element in all_elements: > print regex.match(element) > > > Tell me if that works for you! > > Cheers! > > El jueves, 21 de febrero de 2019, 21:17:23 (UTC+1), Francesco escribió: >> >> Hi everybody! >> >> I have a question on whether it's possible to ignore the case sensitivity >> when checking if something exists. Here's an example: >> >> if cmds.objExists("L_*_CNTL") == False: >> cmds.error("Error! No left side CNTLs were found!") >> >> Basically I want to check if there are controllers that have the "L" >> prefix and "CNTL" suffix, but sometimes there might be scenarios where the >> rigger used different naming conventions, using lower case "l", lower case >> "cntl" or a mix, like "Cntl". >> >> >> Thanks! >> >> -Francesco >> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/60366ba7-f151-4ebd-8201-edd082a26464%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.