Skip to content

Using regex thows error #37

@ouija

Description

@ouija

Hi there,

Just realized that you released an update a few years ago that allows you to use a regex when targeting data to parse, however, when I try to utilize this, the script appears to be throwing an error:

 Got error 'PHP message: PHP Warning:  preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 249 in /vendor/aymanrb/php-unstructured-text-parser/src/TextParser.php on line 68
PHP message: PHP Fatal error:  Uncaught TypeError: array_keys() expects parameter 1 to be array, null given in /vendor/aymanrb/php-unstructured-text-parser/src/TextParser.php

I am using $parser->parseText($message)->getParsedRawData(); in conjunction with this, if that helps.

And simply testing trying to extract a phone number from the text, something like +17785542644 using a variable with regex such as {%customer_phone:^\+\d{1,15}$%}

Using a plain variable such as {%customer_phone%} has no issue, only when I attempt to use a regular expression.

Let me know if you have any insights! Thank you.

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