SayRegexp Problem


#1

Using this regexp: (for websource parsing)
sayregexp “(?<=“artists” data-aid=”(\d+)">)[^<]+ ", " “trk-list-cont”

Code for testing (using :mt_ttt:)
(?<=“artists” data-aid="(\d+)">)[^<]+

I’m trying to seperate the artists from the following code example.
Artist 1Artist 2trk-list-cont

To result in:
Artist 1, Artist 2

As you can see the digits are the non fixed width. Only it returns an Invalid lookbehind error. Which is down to the regexp language used by Mp3tag (I think), so… .

  1. Any workaround for this?
  2. What regexp language does Mp3tag use as .NET regexp can take advantage of non fixed widths inside lookarounds.

#2
  1. Maybe KillTag can be of help here?
    killtag "a"
    killtag “/a” ", "

  2. Mp3tag uses boost::regex which doesn’t support non-fixed widths inside lookbehind.

Kind regards
– Florian


#3

Or maybe do a regexpreplace for the data-aid value to make them all uniform if you don’t need those identifiers anymore. Could be numbers or letters, whatever you choose. Here, I’m going to swap those digits with a string of zeroes:

regexpreplace “(class=“artists” data-aid=”)\d+" “${1}00000”

<a href="/artist/artist 1" class="artists" data-aid="392805">Artist 1</a><a href="/artist/artist 2" class="artists" data-aid="3805">Artist 2</a>trk-list-cont

to

<a href="/artist/artist 1" class="artists" data-aid="00000">Artist 1</a><a href="/artist/artist 2" class="artists" data-aid="00000">Artist 2</a>trk-list-cont

Now, you have don’t have non-fixed lengths to worry about.


#4
QUOTE (Florian @ Jul 1 2017, 19:13) <{POST_SNAPBACK}>
1. Maybe KillTag can be of help here?
killtag "a"
killtag "/a" ", "
  1. Mp3tag uses boost::regex which doesn’t support non-fixed widths inside lookbehind.

Kind regards
– Florian


Thanks. I’ve never actually had to use killtag before. I’ll try see if I can make use of it. I’ve used the solution as below.

I suppose there’s no furture plans to migrate to .NET regex?

Thanks. Yeah, that’s exactly what I’ve been doing for years. Just wanted to see if there was a headon solution.

My solution: (is to enable fixed length lookbehind)
regexpreplace “(“artists” data-aid=”)\d+" “$1albumartist_fix”


#5

Yeah, yours makes the most sense when targeting %albumartist%.