Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search and Select uses regex only if match case is off. #173

Open
Okxa opened this issue Mar 17, 2024 · 0 comments
Open

Search and Select uses regex only if match case is off. #173

Okxa opened this issue Mar 17, 2024 · 0 comments

Comments

@Okxa
Copy link
Contributor

Okxa commented Mar 17, 2024

search_and_select function has an issue where the regex is only used if match case is checked, regardless of "Use Regex" checkbox.

https://github.com/Weisl/simple_renaming_panel/blob/bcdcf9fc7f26729f3f63fd126bda1f9343cd34e7/operators/search_select.py#L53-L59

Something like this should work:

if wm.renaming_useRegex == False:
    if wm.renaming_matchcase == True:
        if entityName.find(searchReplaced) >= 0:
            selectionList.append(entity)
            msg.addMessage("selected", entityName)
    else:
        if re.search(searchReplaced, entityName, re.IGNORECASE):
            selectionList.append(entity)
else:
    if re.search(searchReplaced, entityName):
        selectionList.append(entity)

It should be the correct logic, assuming the previous implementation was correct for renaming when ignoring case. (And if when searching with regex the match case option should be ignored. Atleast the Match Case checkbox is greyed out when Use Regex is checked)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant