Error with format regexp compared to regular replace with regular expression

The below works with the replace with reg exp action:

Replace: ([^\s,]+)
Replace With: [url="https://urlhere=$1"]$1[/url]

But this doesn't in the format regexp function.


It returns an error:

  "REGEXP ERROR: Regular expression

Invalid preceding regular expression prior to repetition operator.  The error occurred while parsing the regular expression: '(+?>>>HERE>>>)'."

Is this a bug?

I cannot use ' between ([^\s,]+) as it leads to unwanted results. And I need the $regexp fn as it's for use in an export file.

Basically what I want is:

String is:

test1, test2, test3


[url=https://urlhere=test1]test1[/url], [url=https://urlhere=test2]test2[/url], [url=https://urlhere=test3]test3[/url]

My brain is not functioning properly today and can't figure it out. Cheers.

Think I got it.





Possibly a bug, I don't know.

Nope still not working when the artist is.
test1, test2, test3

Only works with as artist

Trying to understand ...

'#'$regexp('test1, test2, test3','([^\s,]+?)','x')'#'
'#xxxxx, xxxxx, xxxxx#'

... where is the problem?



Example from 1st post modified below for clearer understanding:

Artist string is:

artist1, artist2, artist3

Required output of artist to export script:

[url=https://urlhere=artist1]artist1[/url], [url=https://urlhere=artist2]artist2[/url], [url=https://urlhere=artist3]artist3[/url]

Notice each of the artists 1, 2 & 3 are used twice for the URL and the text display.

$regexp('test1, test2, test3','(\w+)(,?)','[url="https://urlhere=$1"]$1[/url]$2')
[url="https://urlhere=test1"]test1[/url], [url="https://urlhere=test2"]test2[/url], [url="https://urlhere=test3"]test3[/url]


I can do that with my non-working version.

If you try this it doesn't work with artists with more than one word. Sorry for not giving that example.

Try Artist string:

This Artist1, This Artist2, This Artist3

That's why I was trying the don't match ,\s to alleviate any problems but it appears the $regpexp fn is written differently than the replace with regular expression action as the $regexp one fails where the action does not.

Got a working version:

Seems hacky but it works:

$regexp('This Artist 1, This Artist 2, This Artist 3','\s*([^\,]+[^,\s])','[url="https://urlhere=$1"]$1[/url]')

resulted in: notice no space between ,

[url="https://urlhere=This Artist 1"]This Artist 1[/url],[url="https://urlhere=This Artist 2"]This Artist 2[/url],[url="https://urlhere=This Artist 3"]This Artist 3[/url]


$trim($regexp('This Artist 1, This Artist 2, This Artist 3','(,*)\s*([^\,]+[^,\s])','$1 [url="https://urlhere=$2"]$2[/url]'))

This Artist 1, This Artist 2, This Artist 3

Yes, that's looking good and works ok. Thank you.


No probs.

I still maintain there might be something wrong in the $regexp fn. Maybe not. Glad there's a solution.