


LanguageTool: words followed by a word different from

How can I match a series of words followed by a word different from x? For instance, how can I match at the cost of followed by a word different from some? I have tried the following, but to no avail: <rule id="AT_THE_COST_OF_!SOME" name=&quo

Extracting the last 'Caused by' from a stack trace with regex

Unfortunately, I'm not yet a regex expert and therefore fighting with the following problem: Assuming I've got a Java stack trace including multiple chained exceptions, what I want to reach is extracting the last line starting with "Caused by".

Regex performance issue on a very large chain

Right now I am new to using regexes so I would really appreciate your help. I have a really large string (I am parsing an as3 file to json) and I need to locate for those trailing commas out there in the objects.. This is the regex I am using public

Delete a line with a pattern unless another pattern is found?

I have a very messy data file, that can look something like this ======== Line 1 dfa====dsfdas== Line 2 df as TOTAL ============ I would like to delete all the lines with "=" only in them, but keep the line if TOTAL is also in the line. My code

Replace commas in the C # string

I have a string like this: select name,lastname,email from contacts I want to replace the commas for +"|"+ and get something like this select name+"|"+lastname+"|"+email from contacts thats easy with string.Replace(",&qu

Returns the numeric value of a string in PHP

How can I get the numeric value from an string? In my case string is R1350.00 and Expected output: 1350 I tried the following: $result = preg_replace("/[^a-zA-Z0-9]+/", "", 'R1350.00'); but I also want to remove the last two string 00.

Need help for a simple javascript regex

I need to get a specific class with javascript. This class is bootstrap's grid : col-md-8 I need to get the number, I try this : $class = $('div').attr('class'); $number = $class.match(/^col-md-./); I'm real beginner in regex, please help me. EDIT :

Perl Match Substring in a chain ignore spaces

I have a string $str = "xxxxxx Code File(s) Name:Some_thing.c CodeFile(s) Version:27 Design Document:some_other_design.doc Module Design Document Version:43 somexxxxxxxxxx Compiler Version:9.5 Doc Type:Word xxxxxx"; where xxxxx represents any ch

regex to add a hyphen in the dates

In R I have a character string that looks like the following x <- c("20130603 00:00:03.102","20130703 00:01:03.103","20130804 00:03:03.104") I would like to to look like the following by using a single gsub command (rather

grab the string between characters with jquery

I have a variable which contains "j_id0:j_id11:i:f:pb:d:MyFieldName.input" (without the quotes). Now I would like to capture "MyFieldName". I had this: var test = "j_id0:j_id11:i:f:pb:d:MyFieldName.input"; var testRE = test.m

Cut the numbers at the end of String

I want to trim the last occurring numeric characters from the String Eg: "abc123" => "abc" "abc12xyz34" => "abc12xyz" Written below snippet to extract it. Just want to explore if this can be done by regex priv

Regular phrase containing one word or another

I need to create an expression matching a whole number followed by either "seconds" or ""minutes" I tried this expression: ([0-9]+)\s+(\bseconds\b)|(\bminutes\b) It works fine for seconds, but not minutes. E.g. "5 seconds&quo

PHP: preg_replace (), `e`-modifier and object

I'm writing a method which returns an function argument by its number. protected function parseArgs($str, $args) { return preg_replace('|#(\d)|e', '$args[\\1 - 1]', $str); } $str - a string with '#N' where N is a number of argument $args - array of a

php Regex - Invalid pattern not getting the desired results

I have a file that I am reading, and searching the entire file for a certain pattern. Here's sample line: DATA "1354236384craan18p.1354236392craan18p.1354668684AR_ESCALATORCase HD0347023 was automatically closed on 5/12/2012 1:51:24 p.m.." "

Statement of Regular Expression

I've never been good with regex and I can't seem to get this... I am trying to match statements along these lines (these are two lines in a text file I'm reading) Lname Fname 12.35 1 Jones Bananaman 7.1 3 Currently I am using this for a while stateme

.htaccess for SSL?

I have: RewriteCond %{HTTP_HOST} ^MYDOMAIN\.com$ [NC] RewriteRule ^(.*)$ http://www.MYDOMAIN.com/$1 [L,R=301] RewriteCond %{HTTPS} !=on RewriteCond %{REQUEST_URI} ^/(user|admin|cart) RewriteRule ^(.*)$ https://www.MYDOMAIN.com/$1 [R=301,L] This effec

Android - split when a line break in String? (Paragraphs)

I am currently retrieving some information from a text file (.txt) that contains some paragraphs. When I retrieve the String from the text file I want to split it so that I each paragraph is in a String object. Here is the text I get from the text fi

Regex: matching sql params without double quotation marks

I am dealing with an SQL injection and I need to replace sql params in coldfusion querytags by cfquerparam tags. For this I am matching anything that looks like the params in this: select * from table where test = #var2#, test ='#var3#' test2 like '%

Regex does not accept a 10-digit phone number

I am using this regex to validate for the phone number: ^(\\([2-9]\\d{2}\\)|[2-9]\\d{2})[- ]?\\d{3}[- ]?\\d{4}$ However, when I test the input of any 10-digit phone number without dashes or spaces, such as 4042128246, the number does not match. How c

how to extract a chord part and ignore the number in jquery?

I have a string like foobar1, foobaz2, barbar23, nobar100 I want only foobar, foobaz, barbar, nobar and ignoring the number part.If you want to strip out things that are digits, a regex can do that for you: var s = "foobar1"; s = s.replace(/\d/g

Deleting redundant line breaks with regular expressions

I'm developing a single serving site in PHP that simply displays messages that are posted by visitors (ideally surrounding the topic of the website). Anyone can post up to three messages an hour. Since the website will only be one page, I'd like to c

Empty all methods in a file in vim, regex?

I am using the vim editor and I wanted to empty out all methods in the class, for instance class A { public: int getNumber() const { return number; } void setNumber(int num) { number = num; } }; I wanted to have a regex where I could substitute so th