Skip to content

Wildcard search issue when using multiple wildcards in Wildcard And Lora Syntax Processor (Mikey) node #64

@Zach-Yee-Haw

Description

@Zach-Yee-Haw

Problem:

If we try to generate a specific character from a wildcard with a random occupation with this prompt:
(characters|character1), BREAK,
(occupations), complex outfit), BREAK,

Using the Wildcard and lora syntax processor node, we should obtain this:
(character1), BREAK,
(Random_Occupation), complex outfit), BREAK,

However, we get this:
(), complex outfit), BREAK,

In the console, we find that the searched term was this:
character1__), BREAK, \n(( __occupations

Solution?

I have found that there is an ambiguity in the regex at line 319, where the double underscore was allowed in the search:
wildcard_regex = r'((\d+)$$)?(!|+|-|*)?((?:[^|_]+_)[^|_]+)((?:|[^|]+))'

I'm not an expert in writing regexes, but I have found that this works so far, though I have not tested it thoroughly:
wildcard_regex = r'((\d+)$$)?(!|+|-|*)?((?:[^|_]+_)[^|_]+)((?:|[^|_]+)?)'

I am putting this as an issue because I am not confident that the fix is robust and I would rather have someone more knowledgeable take a look before committing anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions