Questions tagged as 'regex'

3
answers

Verify that the first letter is a vowel

I am trying to validate with a regular expression that the first letter is a vowel in the following way, but I can not. String pattern = "[aeiouAEIOU]{1}[A-Za-z]"; String buscar = "alphabet"; if (buscar.matches(pattern))...
asked by 02.09.2018 / 13:40
2
answers

Convert thousands and decimals with Regular expression

I need your help because I have a regular expression to convert a number to millles and decimals, but when I put more than three decimal places it also formats decimals, how could it be removed ...? function milesNumeros(numero) { return n...
asked by 06.12.2016 / 22:53
2
answers

Error trying to find the first letter and the first vowel

I saw another question that I was trying to solve as, of any word, always show the first letter and the first vowel, that is: "mapita" -> ma "astro" -> ao function palabra(w){ var toArray = w.split(""), regex = /aei...
asked by 19.10.2017 / 16:43
2
answers

RegEx: Capture text between backslashs (Path)

Let's see if you can help me please. I am trying to capture with RegEx with the program "The regex Coach" the names of the directories and subdirectories of a path. Example:    Projects \ UP / PS (21063) \ 2789 (spain) / Ref / 15 \ Email...
asked by 13.08.2018 / 10:35
1
answer

Delete only the final "O" but respect the letter in "HELLO"

I am interested in eliminating the O of each word, except that that word is HELLO . I'm trying this but it does not work for me: a <- c("HELLO DO","DO HELLO XO","HO") gsub("[^HELLO]O\>","",a) [1] "HELLO " " HELLO " "HO...
asked by 05.12.2017 / 05:44
1
answer

Meaning of '(. * [^ \\\\])'

Looking at the configuration files of prestashop , I found a regular expression. I do not know if it's complete, it's used in prestashop\controllers\admin\AdminTranslationsController.php define( '_PS_TRANS_PATTERN_', '(.*[^\\])' );...
asked by 09.05.2017 / 12:43
2
answers

Save all matches of a group in Regex

Consider the following group: ([0-9 ]+)+ I capture matches that contain numbers and spaces, in the following string for example: 123 , 2133132, 31331, 22222222, 23...... would capture "23", the last match, but what I want is to be abl...
asked by 27.05.2017 / 19:19
1
answer

Problems with matches

I want to do a match check, which checks that the string contains 5 or more characters that are neither the ñ, nor the z, nor the x. I have tried it in the following way: b=s.matches("\w{5,}[A-z[^ñzx]][A-z[^ñzx]][A-z[^ñzx]][A-z[^ñzx]][A-z[^ñzx...
asked by 22.12.2018 / 20:06
1
answer

Count line breaks in a file.txt with Python

I am doing a lexical analyzer for a class and one of the things that it must accomplish is to count the line breaks. How can I count the line breaks in Python from a text file? This is my code, am I using regular expressions? **def newLine(lin...
asked by 12.12.2018 / 08:41
1
answer

[ao] is the same as (a | o)? Regular expressions

I'm studying regular expressions, I've noticed that perr[ao] and perr(a|o) are equivalent. Here comes my doubt (which surely is a bullshit), is there no difference in this regard? That is, by writing less, could I use perr[ao...
asked by 02.07.2018 / 22:08