currently I am very confused! I have been trying to solve this for a while, and can't seem to crack it. I can't even find an answer on Google.
Currently I am using this Regex I wrote in Javascript:
((?: {4,}|\t+)(?:.*))
Simply, it matches everything that is 4+ spaces out or 1+ tabs out in a textarea. Yea, that sounds familiar you say? It is simply what Stack Overflow does for codeblocks. Now, I have run in to an issue.
Basically I am wanting to replace all of these instances found in the textarea, but first I want to back them up to an array. Now, I am not sure how I grab each match found, and insert it in to the array.
Here is what I have so far:
.replace(/((?: {4,}|\t+)(?:.*))/gi, function (m, g1, g2) {
return //STUCK HERE
}); //Matches Bold
So simply, I just want to grab all matches found in a textarea (Either indented or 4 spaces) and then I would like to add the contents of the match to an array. How would I go about doing this? Please Help!
(?:.*)? Isn't just.*exactly the same? Also, we can't help you with replacing that text if you don't tell us what you want to replace it with.(?:.*)is so it does not match that in particular, I want it to just match the whole regex as a whole. Second, simply I am trying to backup codeblocks because I am making a Markdown parser. Then after I run all of the other regexs I would like to restore the code blocks. Now, for what I would like it to return, it could return just the same thing I guess.