1
Let’s say I have the following string:
str = "http://www.google.com/joao.pedro?a=b";
Then I want to take just the Joao. using Javascript.
I believe you can do with Regex somehow, someone can help me as?
I thought of something like, use this regular expression:
(http://www.google.com/)([\d\w\.]+)
And take the value that would be between the second parentheses. In PHP you can do something like this using the function preg_match
, but and in Javascript?
I’ll edit the question.
– Ale
I want to extract the name that is after . com/ and before ??... Anyway, I think I’m finding the solution here and already put in Stack.
– Ale
See: https://jsbin.com/wesapo/edit?js,console
– NoobSaibot
Yes, I used the match function instead of this, but the result is the same. See my answer, if I wrote something wrong please tell me to correct, or post one of yours that I will mark as the best answer, since it solves my case.
– Ale