I am kind of new to regex, and haven't used it much before.
I am trying to match the following string String A
and replace it to String B
String A:
+ ANYTHING_NO_SPACES.prototype.ANYTHING_NO_SPACES = function()
{
ANYTHING
}
String B:
ANYTHING_NO_SPACES.prototype.function_segments.ANYTHING_NO_SPACES.push(function())
{
ANYTHING
})
ANYTHING_NO_SPACES
means anything can be put there with no spaces
ANYTHING
means anything can be put there, spaces etc.
I also would like to ignore new lines, so a new line would be the same thing as a space or nothing.
EDIT: Here's what I've got so far:
(\+ \w+.prototype\.\w+ = function\(\)( |\n){([\S\s]*?)})
I can't figure out how to finish the last bit.. changing to string into string b
Any ideas on how to finish that?