How to group only words, no spaces?
Hi, i want group all words without white space e.g.: I like stackoverflow [0]I [1]like [2]stackoverflow i know its a easy regex but i forgot how i do that xP. ...
Hi, i want group all words without white space e.g.: I like stackoverflow [0]I [1]like [2]stackoverflow i know its a easy regex but i forgot how i do that xP. ...
Consider a regex for testing port numbers. (6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}) This is not valid in Android. Any idea what a port number regex should look like in Android? ...
(Update: this question's main focus is to test the "nothing else" part) Given a string s, which can contain anything, what is the most correct regexp in Ruby to check whether it is a single digit and nothing else? (a single digit and only a single digit). ...
At the moment I am using this line to take a string and extract only the letters from it: string.scan(/[a-zA-Z]/).to_s How do I modify this so that the underline character, "_", is also included? Thanks for reading. ...
I'm trying to parse arguments for a command, but if I were to put multiple spaces in a row, String.split() will leave empty Strings in the result array. Is there a way I can get rid of this? For example: "abc 123".split(" ") results in {"abc", "", "", "", "", "123"} but what I really want is {"abc", "123"} ...
Hey there, I love regular expressions, but I'm just not good at them at all. I have a list of some 400 shortened words such as lol, omg, lmao...etc. Whenever someone types one of these shortened words, it is replaced with its English counterpart ([laughter], or something to that effect). Anyway, people are annoying and type these shor...
Hi, It would be great if someone could provide me the Regular expression for the following string. Sample 1: <div>abc</div><br> Sample 2: <div>abc</div></div></div></div></div><br> As you can see in the samples provided above, I need to match the string no matter how many number of </div> occurs. If there occurs any other string bet...
Let's say I ask a users for some random letters and numbers. let's say they gave me 1254jf4h. How would I take the letters jfh and convert them inter a separate variable and then take the numbers 12544 and make them in a separate variable? ...
I know that I can use regex to match substrings in a string, but is it possible to match some patterns in binary data using regex? If so then in what format should the binary data be - binary array, stream, or something else? edit: well to explain i have binary data that shouldnt have some strings inside but the data itself is binar...
I have a directory which contains subdirectories which contain files. All the file names have a prefix which I want to eliminate. The prefix is not exactly the same among all the files, but I have a regular expression that represents exactly the language of these prefixes. I'm trying to write a script in Python to change the name of each...
How do i write a regular expression which accepts only value "1" in the textbox and it should not accept zero or greter than "1" ...
I have strings like "AMS.I-I.D. ver.5" and "AM0011 ver. 2", of which the "ver. *" needs to be stripped. I have done that with: (^A.*)(ver.\s\d{1,2}) The problem occurs when there is no version number like "AM0003". How can I make the (ver.\s\d{1,2}) part optional? ...
Regex newbie here. There's a (broken) plugin for the forum software I use that I'm attempting to fix. It's generating the following regex: /(?:\s|^)\[(?:\:\)\]|;\)\])(?:\s|$)/m ... to replace all instances of [:)] or [;)] in a block of text using preg_replace(). However, it's not replacing the instances of [:)] or [;)]. Any ideas? ED...
I'd like to find the longest repeating string within a string, implemented in JavaScript and using a regular-expression based approach. I have an PHP implementation that, when directly ported to JavaScript, doesn't work. The PHP implementation is taken from an answer to the question "Find longest repeating strings?": preg_match_all('/...
Hi, How can I get all the matches in the following example: // Only "abcd" is matched MatchCollection greedyMatches = Regex.Matches("abcd", @"ab.*"); // Only "ab" is matched MatchCollection lazyMatches = Regex.Matches("abcd", @"ab.*?"); // How can I get all matches: "ab", "abc", "abcd" Thanks. Peter P.S.: I want to have the all...
Bash scripting does my head in. I have searched for regex assignment, but not really finding answers I understand. I have files in a directory. I need to loop through the files and check if they fit certain criteria. File names under a certain sequence need to have their sequence increased. Those over a certain sequence need to trigger ...
I had a code that turned http:// in to <a links. the issue with it was that it would break images and flash players. It was using Regex. Does anyone know of a Regex code that would do this? ...
My homework is to write a regular expression representing the language of numerical literals from C programming language. I can use l for letter, d for digit, a for +, m for -, and p for point. Assume that there are no limits on the number of consecutive digits in any part of the expression. Some of the examples of valid numerical liter...
Hi. In my string I have some unclosed html tags. For example <div><p></p> or <p><b></p> I'm using asp.net c#. Maybe regex can works. ...
Hi everyone. I need a regular expression to match a very specific sentence format. The format is as follow: word(that can contain ,()[]&^%# and whitespace), word(that can contain ,()[]&^%# and whitespace), word(that can contain ,()[]&^%# and whitespace) So basically it's a word, word, word but every word can contain some special charac...