regex

Remove periods from the end of markdown paragraphs

I have a bunch of posts written in markdown and I need to remove the periods from the end of every paragraph in each of them The end of a paragraph in markdown is delimited by: 2 or more \ns or The end of the string However, there are these edge cases Ellipses Acroynms (e.g., I don't want to drop the final period in "Notorious B.I...

regex: replacing the 1st occurrence of a character in a string

I have this string:- ABCDE/Something something:XYZ=0, JKLM=0/SOMETHING Something:some_value What is the regex so that only the first colon (:) is replaced with underscore (_)? ...

Regex for (see question)?

Hi guys, Here is an easy one :) on REGEX I have this regex "^\\$?(\\d{1,3},?(\\d{3},?)*\\d{3}(\\.\\d{2})?|\\d{1,3}(\\.\\d{2})?|\\.\\d{2}?)$" which works on {100, $100, $100.15, $1,000, $1,000.15} and so on.... I want a simple Regex which works on numbers like : {100, 100.15} and thats all - no commas and currency symbols crap... T...

extracting first letter of a String with Regex

Hello there!! I am new to the RegEx and i want to be able to search and replace particular texts in my text-file. I was able to do most of the searches but here is one that i couldn't quite get the hang of it. I think i should be using the look around/look ahead/look behind. But the tool i'm using says syntax error. Basically here is t...

JQUERY - IF the element's current value ends with !!!, trigger an Alert

Given: var value = $this.text(); Where value equals: Phasellus pellentesque metus in nulla. Praesent euismod scelerisque diam. Morbi erat turpis, lobortis in, consequat nec, lacinia sed, enim. Curabitur nisl nisl, consectetuer ac, eleifend a, condimentum vel, sem. When the user types in: Where value equals: Phasellus pellentesque me...

Replace a string multiple times using regular expression

Hi All, for example we have date May 12, 2010 <cfset may_12_2010 = CreateDate(2010, 5, 12)> using DateFormat function, we can use DateFormat(may_12_2010, "mmmm m dddd d yyyy") which will show May 5 Wednesday 12 2010 if for some reason I can't use the DateFormat function, how we can show the same results (with the same mask) with...

What is a "tagged DFA"?

I came across a regular expression library http://laurikari.net/tre/ and also http://hackage.haskell.org/package/regex-tdfa , but I could not find anything about this "tagged DFA" approach that they are using: neither on the pages of these libraries, nor in google (incl.scholar). Anyone know what it is about? ...

What does this Regular Expression Mean

$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); And is there any place I can learn regular expressions? I know the basics. ...

A few questions regarding $_SERVER['HTTP_USER_AGENT'] and using RegEx to extract information from the results

Okay, take this user agent for example: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Curious as to what all of it means. I can figure out a few things, obviously, such as Mozilla == Firefox, and Windows NT 5.1 == Windows XP. But what is the rv:1.9.2.6, and What is Gecko? and U? And also, I'm working on se...

How to write this regex expression

Hi In my HTML I have below tags: <img src="../images/img.jpg" alt="sometext"/> Using regex expression I want to remove alt="" How would I write this? Update Its on movable type. I have to write it a like so:(textA is replaced by textB) regex_replace="textA","textB" ...

How to append or replace trailing question marks using preg_replace?

I want to enforce single question mark at the and of the string. In JavaScript it works perfectly: var re = /[?7!1]*$/; document.write('lolwut'.replace(re, '?')); document.write('lolwut?'.replace(re, '?')); document.write('lolwut??'.replace(re, '?')); document.write('lolwut???'.replace(re, '?')); document.write('lolwut???!!!11'.replace(...

Regex expression to split a line to three segments in Perl

I am parsing a text file and I get multiple lines in the form shown below. Then I try to split each line to three segments: Part1: sf; part2: name; part3:direction. But now I am encountering difficulty in how to write my regular expression. I have thought about splitting on whitespace and using an array to concatenate new strings: S1...

Negative look-around

the following regexp is wrong - can someone please help to find all :-) that do not have "please ignore me " in front? I have not previously needed such an regexp. The word boundaries might confuse things. Thanks <script type="text/javascript"> function regexTest(string, assert) { document.write('<hr>') document.write(string) docu...

Difference between (.|[\r\n]){1,1500} and ^.{1,1500}$

What is the difference between below two regular expressions (.|[\r\n]){1,1500} ^.{1,1500}$ ...

Simple-Build-Tool Error highligtning in JEdit

Hello All I currently experimenting with different lightweight texteditors for Scala development. JEdit seems to enable the user to make many tweaks. However im currently having a problem with its error and warning highlightning, via the Console plugin. It marks some lines as errors without actually being it. Thats why I wanted to ...

RegEx To Match "whole word" returns exception

I am trying to validate via RegEx as follows... If Regex.IsMatch(Output, "\b" & "Serial)" & "\b") Then 'do something end if but i get this Argument exception parsing "\bSerial)\b" - Too many )'s. I do understand the error, but how should i modify the RegEx expression? UPDATE. The word "Serial)" is generated dynamically. That means...

using preg_replace to add backslash before single quote

How to add a backslash before single quotes using preg_replace() php function ? ...

Does regex allow you to parse strings? If so, how?

I've used regex in the past for input validation, but I am wondering if they can let you parse a complex string. I have a header like this: -----------------------------7dac1d2214d4\r\nContent-Disposition: form-data; name=\"my_title\"\r\n\r\nMyData\r\n-----------------------------7dac1d2214d4\r\nContent-Disposition: form-data; name=\"m...

How to parse raw POST data into array?

I have a raw form-data that look like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="title" T ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="apiKey" 98d32fdsa ------------V2ymHFg03ehbqgZCaKO6jy C...

regular expression in groovy

How to find whether the string contains '/' as last character . I need to append / to last character if not present only ex1 : def s = home/work this shuould be home/work/ ex2 : def s = home/work/ this will remain same as home/work/ Mybad thought this is simple, but fails thanks in advance ...