can we check multiple patterns using regex in java?
i want to check 2 patterns using regex. can i check those both patterns in the same time (like if(condition1 | condition2) condition). any idea? ...
i want to check 2 patterns using regex. can i check those both patterns in the same time (like if(condition1 | condition2) condition). any idea? ...
This regex comes from Atwood and is used to filter out anchor tags with anything other than the href and a title: <a\shref="(\#\d+|(https?|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+)"(\stitle="[^"]+")?\s?> I need to allow am additional attribute that specifically matches: target="_blank". So the following url should be allowed: <a href=...
Hi, I'd like to validate user input with regular expression in Django Admin CharField... How is it possible? Thanks in advance, Etam. ...
if($title =~ s/(\s|^|,|\/|;|\|)$replace(\s|$|,|\/|;|\|)//ig) $title can be a set of titles ranging from President, MD, COO, CEO,... $replace can be (shareholder), (Owner) or the like. I keep getting this error. I have checked for improperly balanced '(', ')', no dice :( Unmatched ) in regex; marked by <-- HERE in m/(\s|^|,|/|;|\|)Ow...
I am trying to use this regex (JS): /\/\*(.*)\*\//g To replace /* sdandsads */ with nothing. But it is not working! Why? o_O ...
Can someone please help me with using Regex with NSPredicate? NSString *regex = @"(?:[A-Za-z0-9])"; NSPredicate *pred = [NSPRedicate predicateWithFormat:@"SELF MATCHES %@", regex]; if ([pred evaluateWithObject:mystring]) { //do something } testing the above wth mystring - qstring123 doesn't seem to work. I am expecting it to enter ...
The text file has hundreds of these entries (format is MT940 bank statement) {1:F01AHHBCH110XXX0000000000}{2:I940X N2}{3:{108:XBS/091502}}{4: :20:XBS/091202/0001 :25:5887/507004-50 :28C:140/1 :60F:C0914CHF7789, :61:0912021202D36,80NTRFNONREF//0887-1202-29-941 04392579-0 LUTHY + xxx, ZUR :86:6034?60LUTHY + xxxx, ZUR vom 01.12.0...
I'm seeking a solution to splitting a string which contains text in the following format: "abcd efgh 'ijklm no pqrs' tuv" which will produce the following results: ['abcd', 'efgh', 'ijklm no pqrs', 'tuv'] In other words, it splits by whitespace unless inside of a single quoted string. I think it could be done with .NET regexps usi...
Need to replace a domain name on all the links on the page that are not images or pdf files. This would be a full html page received through a proxy service. Example: <a href="http://www.test.com/bla/bla">test</a><a href="/bla/bla"><img src="http://www.test.com" /><a href="http://www.test.com/test.pdf">pdf</a> <a hr...
I have a string ABCD:10,20,,40;1/1;1/2,1/3,1/4 I want to split the string into the following parts: ABCD -- splited by : 10,20,,40 -- splited by ; 1/1 -- splited by ; 1/2,1/3,1/4 -- splited by ; Why the following regular expression does not work for me ? string txt = @"ABCD:10,20,,40;1/1...
I've been trying to figure out how to write this regular expression. It is to be used for ISAPI_Rewrite, a module for IIS 6, for doing URL rewriting. I want the url /hg/<parameter> to be mathed, so it can be rewrited to /hg/hgwebdir.cgi/<parameter>. I've matched it using ^/hg/(.*). My problem is, if the URL /hg/hgwebdir.cgi/<parameter...
Hi! I have a problem with regular expressions! How can i count html tags with regex? ...
Yes I know its usually a bad idea to parse HTML using RegEx, but that aside can someone explain the fault here: string outputString = Regex.Replace(inputString, @"<?(?i:script|embed|object|frameset|frame|iframe|metalink|style|html|img|layer|ilayer|meta|applet)(.|\n)*?>", ""); if (outputString != inputString) { Console.WriteLine("unw...
how to remove the \n, \t and spaces between the strings in java? ...
I have a list of phone numbers that start with the below numbers and in different formats...i need to grab the numbers that start only with the below numbers/format using php...... 020 8 07974 +44 (0) 20 +44 0 440203 any help will be appreciated.. ...
I'm trying to match on an option group in Scala 2.8 (beta 1) with the following code: import scala.xml._ val StatementPattern = """([\w\.]+)\s*:\s*([+-])?(\d+)""".r def buildProperty(input: String): Node = input match { case StatementPattern(name, value) => <propertyWithoutSign /> case StatementPattern(name, sign, value) => <p...
Hello, I am a bit puzzled with my Regex results (and still trying to get my head around the syntax). I have been using http://regexpal.com/ to test out my expression, and its works as intended there, however in C# its not as expected. Here is a test - an expression of the following: (?=<open>).*?(?=</open>) on an input string of: <op...
This simple Python method I put together just checks to see if Tomcat is running on one of our servers. import urllib2 import re import sys def tomcat_check(): tomcat_status = urllib2.urlopen('http://10.1.1.20:7880') results = tomcat_status.read() pattern = re.compile('<body>Tomcat is running...</body>',re.M|re.DOTALL) ...
Hi there, I need some help. I am looking for a regex that would match the last space character in a string. I am using JavaScript and classic ASP. I have a long string of text which I trim to 100 characters. I would like to remove the last character to avoid a spelling mistake if the trim cuts a word due to the 100 characters limit. re...
Is there a logical way to strip out function names and their arguments using Regular Expressions in PHP? Currently I have it splitting line by line so that I am able to have each function on each line for easier markup. So: doSomeFunction(arg, moreargs, stuff); breakSomething(); ini_set(include_path, /home/htdocs/); becomes array([0...