+ 13
[Regex] tips
here a code about regex ! if you wanted to learn it, or to be stronger, it's here 😀 https://code.sololearn.com/W0pNLQ8bef6J/?ref=app
14 Antworten
+ 5
Good one, you helps lot for regex tips/reference
+ 5
thanks :)
+ 4
Quite helpful.
Also one of my weakest areas in Python!
+ 4
you're welcome 😁
+ 4
you're welcome !
+ 4
oninput is when you do something related to the input.
onkeyup is when you pressed a key on your keyboard.
So onkeydown is when you stopped pressing the key.
+ 3
This is actually amazing, thank you!
+ 3
Pepe the Hacker
see my code 9 challenges, I did it :
https://code.sololearn.com/W6mVdUoF5wF4/?ref=app
here is what I did and what you want :
<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" id="entry" placeholder="Enter a number" maxlength="15"/>
this is for allow only numbers. so change the regex by yours !
+ 3
the () ?
it's included on my lesson ^^
it's to group what you want, and you can recall it with $1 (with " ")
for example
string.replace(/hi (nox)/, "hello $1");
here $1 = nox
and you can have multiple $ thanks multiple ()