regex

How does adblock regex work?

Here I found adblock regex explanation. I wish to block all images containing "bbelements" in their url, but neither "bbelements" nor "*bbelements*" worked for me. Surely it must be something very trivial, but I can't figure it out. So how to hide images with bbelements in their url? ...

Regex pattern to parse HttpLog format

I am looking for a regex pattern matcher for a String in HttpLogFormat. The log is generated by haproxy. Below is a sample String in this format. Feb 6 12:14:14 localhost haproxy[14389]: 10.0.1.2:33317 [06/Feb/2009:12:14:14.655] http-in static/srv1 10/0/30/69/109 200 2750 - - ---- 1/1/1/1/0 0/0 {1wt.eu} {} "GET /index.html HTTP/1.1" A...

C# Regular Expression

I can't seem to get this to work. I am looking for a regular expression that will validate a password. Allowable characters are a-zA-Z0-9, but the sequence must have at least 1 number and 1 capital letter. Can this be done? ...

delete html comment tags using regexp

Hi! This is how my text (html) file looks like <!-- | | | This is a dummy comment | | please delete me | | asap | | | ________________________________ | --> this is another line i...

Find and replace variable in Ruby string

Let's say I have a string like so: "Lorem ipsum de color [post]57[/post] sit amet [post]103[/post] desectator." I want to find all occurrences of [post]*[/post] and replace it with the title of the post represented by the number. I'd end up with something like so: "Lorem ipsum de color Angry Turtle sit amet Fuzzy Rabit dese...

regular expression: How do I limit to one result per match

I'm using a simple regular expression on some text data. The expression seems to work fine. The problem I need to get around now, is to only return one result per match as seen in desired matches below. Of course the data would be much larger than this. Example Data: stuffbefore233/stuffafter stuffbefore233/stuffafter stuffbefore111/st...

Java String Manipulating HTML Tags

I have a java string with some text and html: <title>test title</title> blabla bla more text What I am trying to achieve is two-fold: 1) Retrieve the content of <title></title> and save it in a separate string. 2) Remove that part of the original string: <title>test title</title> So the end result would be something like originalS...

first letter up all uppercase words in string data with jquery

hi, my string data as as follow. var HmtlStr = "<span>My names is <u>KERBEROS</u>. AGE: 29, my eyes <b>BROWN</b>.</span" result must be like this which i want; <span>My names is <u>Kerberos</u>. Age: 29, my eyes <b>Brown</b>.</span thank you very much for your help, already now. ...

Java Regex/run on groovy: how to extract all the captured blocks?

Hi, I'm trying to extract two blocks of code from a text file using Java regex. However, I can only extract the last block. Could some one point out what is is wrong with mycode? thanks. here it is import java.util.regex.*; INPUT_START_OR_BLANK_LINE = /(?:\A|\n\n)/ FOUR_SPACES_OR_TAB = /(?:[ ]{4}|\t)/ CODE = /.*\n+/ CODE_LINES = /(...

Confused about this regular expression

Okay, so ^[A-Z] means beginning with a capital letter. So what does ^[A-Z]* mean? Does it not mean zero or more occurrences of a capital letter? Because it is really confusing me since it is including the empty line in the output which is not a capital letter. Also, could you explain ^[A-Z]*$? mugbear:~# clear mugbear:~# cat emptyspace...

In Python, how would you write a regex that matches the following?

The string contains one or more "@" symbols. One or more of those symbols must have a character after it (not a space). ...

Regular Expression: Something out of nothing?

So * by itself means repeat the previous item zero or more times. The output of * is nothing. What about **? This gives an output, but how does matching zero or more times of nothing give something? Could you also explain that please? Same for ?*: Nothing precedes ?, so that is nothing right? How does matching zero or more times of nothi...

need to strip out unwanted text

I need to strip out all text before and including "(" and all text after and including ")" in this variable. var this_href = $(this).attr('href'); The above code produces this... javascript:change_option('SELECT___100E___7',21); However it can produce any text of any length within the parenthesis. A Regex solution is OK. So in t...

How to obscure the numbers in the textarea field.

Hi, I have using cakephp and I want to obscure all numbers which is more than six digits. something like this $string = "My id number is 77765444 in Sales dept."; becomes $string = "My id number is XXXXXXXX in Sales dept." I appreciate any help. Thanks. ...

emacs regexp-replace seems to work unexpectedly

I am trying to remove some <span style="something not constant"> from a text and I tried M-x replace-regexp> "<span*>" -> "" but it does nothing. I made sure the cursor is at the beginning of the file. ...

javascript regex

var siteurl = window.location; var patt= /(http:\/\/)(www.)*([a-zA-Z0-9\.\-]*)(.*)/i; Now i want to get value of $3, how to? ...

get all characters after "," character

Need a Regex to get all characters after , (not including it) from a variable. This variable can contain for example 'SELECT___100E___7',24 'SELECT___100E___7',1 'SELECT___100E___7',286 'SELECT___100E___7',5147 Note: There can be any length of characters after the , in this variable. An explanation of the regexp would be a added he...

Mysql REGEXP 'o' OR 'aw'

I'm trying to do a friend search app. So to do that I'm using regular expressions like: SELECT ... WHERE firstname REGEXP $firstname And the $firstname variable is a string - for example: (ch|k)ris But for some reason it does not work. maybe the ( | ) doesn't work in MySQL? What can I use instead of that operator to do the same ...

Use xPath or Regex?

The two methods below each serve the same purpose: scan the content of the post and determine if at least one img tag has an alt attribute which contains the "keyword" which is being tested for. I'm new to xPath and would prefer to use it depending on how expensive that approach is compared to the regex version... Method #1 uses preg_m...

Mail validation with PHP filter_var() or with regular expression.

I have learned today, that it is possible to validate e-mail two ways. One way is by regular expression and the other is by filter_var() function. If anyone could tell me how strong the validation with filter_var is and if there are any recommendations or suggestions on thoughts about switching from regular expression to it, then it wou...