Jump to content
UBot Underground

Recommended Posts

Can someone please help me getting the following regex to work. the regex works fine in the regex editor but not in the code.

I tried using \\ in place of every \ and that got rid of the errors but it didn't find any results.

 

set(#isbnfile," 0078025877 978-0078025877","Global")
clear list(%isbns)
add list to list(%isbns,$find regular expression(#isbnfile,"(?:ISBN(?:-1[03])?:? )?((?<=[^\\d])|(?<=^))(?=[0-9X]{10}([^\\d]|\\Z)|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}([^\\d]|\\Z)|97[89][0-9]{10}([^\\d]|\\Z)|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}([^\\d]|\\Z))(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]([^\\d]|\\Z)"),"Delete","Global")
 

Thanks,
Ed Newman

Edited by ed08724
Link to post
Share on other sites

which editor?

You need to make sure it is .NET flavor of regex.

 

I use http://regexhero.net/tester/to test my regex and never had an issue in ubot.

 

Also which ubot version?
I did experience some issues with the latest version .43 with unpronounceable results.

 

CD

Link to post
Share on other sites

ubot 5 and I mean the regex editor that can test regex on the view menu in ubot. the regex is fine it just needs to be escaped properly to be put in a string.

Edited by ed08724
Link to post
Share on other sites

In my experience regex hasn't been that long. It would help to see the text or an example of the text you are parsing.

 

Sometimes it is better to do it in more than one step. Break down the HTML or maybe even better use XPATh.

 

Our answer is only as good as the info you provide. More info in, more info returned.

Link to post
Share on other sites

a simple example is in the first line of the example code.

  1. set(#isbnfile," 0078025877 978-0078025877","Global")

you can see if you put both in the editor it works fine. I think ubot is not interpreting the characters correctly when put into a string

Edited by ed08724
Link to post
Share on other sites

i was able to get it to work by putting the regex in a file and then loading the file into a variable then running the find on a variable instead of a constant.
not the ideal answer but it will do.
add list to list(%isbns,$find regular expression(#isbnfile,#regex),"Delete","Global")

Link to post
Share on other sites

I doubt this is a bug its just a matter of properly escaping the string just like if you need a " in a string you need to put \" there are probably other characters that have to be escaped as well.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...