+ 11
Since JavaScript RegExp doesn't allow LookBehind, how can I achieve same results with another way?
Explain only with RegExp.
6 Antworten
+ 7
Lentin, do you have some random regex that you want to match? If no, I'll use a random one as expression.
var str = "Valentinhacker is a hacker" ;
If you want to capitalize the H in your name, using lookbehind will be something like,
str = str.replace(/(?<=Valentin)./, char => char.toUpperCase()) (is it correct?)
But since lookbehinds are not available, you can do str = "Valentin" + str.match(/Valentin(.)/)[1].toUpperCase() + "acker".
Btw, if you have sth to match, I can help you.
+ 5
I've read somewhere that it's indeed done by reversing but i don't know how to reverse...^_^
+ 5
I asked this question because i had trouble with my code "Table Builder" but i found a workaround ^_^
+ 4
You can reverse a String using the following:
function reverse(s) {
return s.split('').reverse().join('');
}
+ 3
As I'm reading this fascinating topic and pondering who wrote the first RegEx parser, I note that lookahead is fully supported.
And I wonder...would reversing the string be a useful start?
+ 2
Yes, I tried using ?<= but it says invalid regular expression -_-