R.NET and Regex

Jan 27, 2015 at 12:20 PM
I am having issues defining a function with a Regular Expression. The code is as follows:

var extractLinks = engine.Evaluate("function(text){ url_pattern <- \"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+\" }").AsFunction();

The error is in spanish, but is related to "Attempt to read or write protected memory"

Any ideas?
Thanks
Jan 27, 2015 at 7:17 PM
Edited Jan 27, 2015 at 7:17 PM
After de-escaping, running that code in RTerm gives me the following error:

Error: '(' is an unrecognized escape in character string starting "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_http[s]?://(?:[a-zA-Z]|[0-9]|[$-_http[s]?://(?:[a-zA-Z]|[0-9]|[$-_http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(" I can also see that error message in RDotNet before the crash.


So, I think there are two separate issues here, one is the error in the regex. The other is the access violation. If you fix the escape error, the crash goes away. In looking at R under gdb, the crash is something we need to look into, but I think you can ignore it for now.