EspoCRM RegEX type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    EspoCRM RegEX type

    Anyone know what Regular Expression type does EspoCRM use?

    I use regex101.com to test and some regex work and some doesn't. It obviously I'm using the wrong setting so it to be expected.

    For example:

    Using this regex in RegEx101 work fine, but if I use it in EspoCRM I don't get a match. Need to know which setting I should be using to be compatible with EspoCRM. Thank you.

    Website: https://regex101.com/
    Link to example: https://regex101.com/r/vctwJB/1

    Screenshot of it:
    Click image for larger version

Name:	image.png
Views:	339
Size:	118.9 KB
ID:	94751

    Fail to output:

    Click image for larger version

Name:	image.png
Views:	303
Size:	19.5 KB
ID:	94752​​
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    Giving this a bump, no one know? Or is the setting correct and it just EspoCRM don't full support PCRE2?

    Comment

    • ThomasB
      Senior Member
      • Mar 2022
      • 163

      #3
      Well, not sure if it helps, but I had also an issue with RegEx and an IfThenElse switch.

      I used string\test

      E. g. I want to test if the input is either the a or b.

      The result of a check of a | b was different from (a | b)

      The first one always returns false even if a or b is set. The second one returned true if either a or b was set.
      So maybe try to put brackets around your whole term.


      Comment


      • esforim
        esforim commented
        Editing a comment
        Thank Thomas, for simpler RegEX it work no problem. Just with this RegEX I want it to stop before the word "Buyer" which is where I'm having the issue and need to find the right setting to see if it a EspoCRM thing or my RegEX string
    • ThomasB
      Senior Member
      • Mar 2022
      • 163

      #4
      Ok, have to tried to enter the RegEx like this?: (Individual:\s*(.*?)\s(.*?)(?=\n|$)(?=.*\Buyer\b))

      Comment

      • esforim
        Active Community Member
        • Jan 2020
        • 2204

        #5
        Originally posted by ThomasB
        Ok, have to tried to enter the RegEx like this?: (Individual:\s*(.*?)\s(.*?)(?=\n|$)(?=.*\Buyer\b))
        Thank you ThomasB, it work good with RegEX101 but doesn't with EspoCRM

        Click image for larger version  Name:	image.png Views:	0 Size:	109.7 KB ID:	95499

        Click image for larger version  Name:	image.png Views:	0 Size:	10.8 KB ID:	95500
        Click image for larger version

Name:	image.png
Views:	259
Size:	10.9 KB
ID:	95501

        Comment

        • ThomasB
          Senior Member
          • Mar 2022
          • 163

          #6
          Try without the / and the start and end. Just like I wrote it: (Individual:\s*(.*?)\s(.*?)(?=\n|$)(?=.*\Buyer\b))
          Last edited by ThomasB; 07-18-2023, 09:39 AM.

          Comment


          • esforim
            esforim commented
            Editing a comment
            You have to have '/ /' start and end for EspoCRM to work. It mandatory in EspoCRM else you get error.
        • ThomasB
          Senior Member
          • Mar 2022
          • 163

          #7
          Ok, I see. Didn't check the docs because for string/test I dont need them.

          I tried your exanple and it looks like it does not like: (?=.*\Buyer\b)

          Seem it does not like two ?=.

          Comment

          • item
            Active Community Member
            • Mar 2017
            • 1476

            #8
            Hi,


            see sample : https://www.php.net/manual/en/functi...-match-all.php

            to try :
            $matches = string\matchAll(......);

            $matches is a array, so in formula script : you need use equivalent foreach
            while (length ....). see sample in forum or doc
            If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

            Comment

          Working...