Questions tagged as 'regex'

2
answers

Can HTML parsing be done with regular expressions?

Yesterday I translated the response from RegEx match open tags except XHTML self-contained tags with its famous snippet of code:    You can not parse [X] HTML with regular expressions because HTML can not be parsed with regex. Regex is no...
asked by 25.07.2017 / 11:11
6
answers

Validate an email in JavaScript that accepts all Latin characters

Question How to validate an e-mail that accepts all Latin characters? By Latin characters I mean accented letters, ñ , ç , and all those used by languages such as Spanish, Portuguese, Italian ... Latin. Context The goal...
asked by 01.12.2015 / 21:55
1
answer

Add borders to words in regular expressions

I want to have in Javascript a function that uses regular expressions to add things to the edges of certain words in a text. Example, I want to replace this:    The swift Indian bat ate happy cardillo and kiwi. The stork played the saxop...
asked by 25.03.2017 / 00:12
5
answers

Validate a date dd / mm / yyyy with regular expressions

The file% co_of% validation date JS fails if you put as days 10 and 20. The code is this: function validaEdat(){ vesSumant(); vfalladata = false; //Comprovació de la data de naixement i el correu electrònic var vregexN...
asked by 31.03.2017 / 16:40
1
answer

Safe way to escape user input to be processed by regular expressions in JavaScript

The following example is published in link : function escapeRegExp(string) { return string.replace(/[.*+?^${}()|[\]\]/g, '\$&'); } Is this the safe way to escape a string provided by the end user, for example through a dialog box?...
asked by 13.02.2017 / 15:48
3
answers

Delete text inside brackets in javascript

I have the following simple code: <input id="nick" type="text"/> <script> var c = document.getElementById('nick').value </script> I need to remove a part of the name, only if it has brackets [] . So if you have thi...
asked by 27.04.2017 / 00:55
3
answers

Decode HTML & # 209 entities & &

I'm using the JQuery autocomplete library. I currently have a function that decodes HTML entities of numeric type - > &#209; , but what I do not know is how to integrate entities of this type into the function - > &amp;...
asked by 24.11.2016 / 20:47
1
answer

Validate 2 regular expressions in a

I have the following regular expression /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i To validate emails, I must also validate that the email...
asked by 28.03.2018 / 16:24
1
answer

Use regex to replace all occurrences with CASE_INSENSITIVE (regardless of uppercase and lowercase)

I try to make a method that finds and replaces words using regular expressions. The point is that I must be able to find and replace the word regardless of whether it has uppercase letters or not. This is the code that I carry: public String r...
asked by 09.11.2016 / 02:51
2
answers

replace values in symbols in a string

I have the following string: Var text='¡Hola $var1$! Gracias $var2$' How can I replace what is between $ by the value of the variable. Example: var1="Juan", var2="Pedro" Resultado='¡Hola Juan! Gracias Pedro' The text can have more var...
asked by 11.07.2017 / 16:47