Regex with "-"-char CAN be numerous "Text" and must end with a newline after the "Text"
What I tried and failed... match.Success is always wrong: Regex pattern = new Regex(@"^-*Text\\r\\n"); sample text: "--My Text" newline+return bla ...
What I tried and failed... match.Success is always wrong: Regex pattern = new Regex(@"^-*Text\\r\\n"); sample text: "--My Text" newline+return bla ...
count_items=`curl -u username:password -L "websitelink" | sed -e 's/<\/title>/<\/title>\n/g' | sed -n -e 's/.*<title>\(.*\)<\/title>.*/\1/p' | wc -l` Above I have a Bash script that extracts the titles from an XML file, but how do I change the regex so that it extracts a title name from a div tag? Example: extract title out of: <div i...
Hey! I'm really new to regex-expressions, so I was wondering if someone would bother to come up with one or more regular-expressions for removing Youtube and Vimeo object url's. It doesen't really matter that it only removes Youtube-objects/embeds, as long as it removes the <object> and </object> and everything in between. Thank you so...
PLURALIZATION_EXCEPTIONS = "hardware",'memory' def pluralize_category_name(name) category = name.split(' and ') exceptions_to_exp = "" category.map! { |e| if e.match(/^[A-Z]+$/) and !e.match(/^[A-Z]+S$/) e = e.pluralize end (PLURALIZATION_EXCEPTIONS.include?(e.downcase) || e.match(/^[A-Z]+S$/) || e.match...
I use $_SERVER['QUERY_STRING'] to get the query sting. A example would be a=123&b=456&c=789 How could I remove the b value from the query string to obtain a=123&c=789 where b can be any value of any length and is alpha numeric. Any ideas appreciated, thanks. ...
Hi I have text inside "textarea" and I was trying to remove the text between: <textarea></textarea> using replace function with some regex. here is what I did so far: x = '<TEXTAREA style="DISPLAY: none" id=test name=test>teeeeessst!@#$%&*(LKJHGFDMNBVCX</TEXTAREA>'; x.replace('/<TEXTAREA style="DISPLAY: none" id=test name=test>.*</TEXT...
Hi all, A newbie question: Let's say I have a string like this: $string = "hello---world"; How would I go about replacing the --- with a single hyphen? The string could easily look like this instead: $string = "hello--world----what-up"; The desired result should be: $string = "hello-world-what-up"; ...
Given a string of identifiers separated by :, is it possible to construct a regular expression to extract the unique identifiers into another string, also separated by :? How is it possible to achieve this using a regular expression? I have tried s/(:[^:])(.*)\1/$1$2/g with no luck, because the (.*) is greedy and skips to the last match...
i need a url regex which validates the url string without http://www. or https://www. any ideas? ...
I have a large file of regular expressions, one per line. I would like to inverse grep another multi-line file against any regular expression that appears in the first file. Something like this: grep -v fileWithManyRegularExpressions fileThatMightMatchSomeRegularExpressions Is there an elegant method to do this aside from looping th...
I'm using [A-Za-z0-9_-] to match letters, numbers and _ and - in my regular expression. I'd like to add the ' character to it but most of my attempts result in server error 500. Here's the full line from my htaccess: RewriteRule ^[A-Za-z0-9_-]+/?$ /index.php ...
Hi People, Just need your help regarding a task to search in Java. I need to read a line from a file and make a list of all the words that have more than 1 capital letter in them. For example if the line is : There are SeVen Planets In this UniverSe The result should be : SeVen and UniverSe I am able to read the line by splitting it ...
I need to write a regular expression for an 'option symbol' for my company so we can validate these symbols across our site. An option symbol is composed of two parts: Part1 Part2 _ _ _ _ _ _ | _ _ _ _ _ _ _ _ _ I can write a regular expression for Part2 as it is fairly simple. However, Part1 (the first 6 character positi...
Hi, My text: var str = 'Cost USD 400.00'; How do i use jquery to find number only in that str? ...
Hi, I need to get rid of trailing repeating non_alphanumeric symbols like "thanks ! !!!!!!!" to "thanks !" If these different symbols then they are ignored. I quite new to regex, so I came up with regexp_replace('Thanks . . . . ', '((\\W)\\s*)(\\2\\s*)+', '\\2') to try it out. However i realise the trailing space after 'thanks'...
I am trying to match inputs like <foo> <bar> #####<foo> #####<bar> I tried #{5}?<\w+>, but it does not match <foo> and <bar>. What's wrong with this pattern, and how can it be fixed? ...
string temp_constraint = row["Constraint_Name"].ToString(); string split_string = "FK_"+tableName+"_"; string[] words = Regex.Split(temp_constraint, split_string); I am trying to split a string using another string. temp_constraint = FK_ss_foo_ss_fee split_string = FK_ss_foo_ but it returns a single dimension array with the same str...
I have the following array: a = ["CH3", "CH2"] and I'd like to split this between two capital letters using a reg expression to display: a= ["C", "H3", "C", "H2"] How do you do this? so far I've tried: a.each { |array| x = array.scan(/[A-Z]*/) puts a } returns: CH CH Thanks in advance! ...
I am working on a .NET MVC application and am trying to write a route in global.asax.cs. The goal is, I want any URL that contains an uppercase character to run through said route. The idea is, the router will lowercase the URL and redirect it. My approach is to use a regular expression to handle this. Here's what I have: routes.Map...
Hey, Say you have the following in files: <script src="../../Public/Javascript/jquery-1.4.1.js" type="text/javascript"></script> <script src="../../Public/Javascript/jquery.easing-sooper.js" type="text/javascript"></script> <script src="../../Public/Javascript/jquery.easing.min.js" type="text/javascript"></script> I'm looking for ...