regex

return words spaces numbers or match everything expect special chars like *&$!^& ?

ok i have some string 'Hello^<php>World&*124>< i ju*st press enteR' how do i return it to ( a function is better ? ) 'Hello World123 i just press enter' allow numbers text spaces , newline , etc how do i do that with a regex? do i have to use regex? is there a another way ? Thanks Adam Ramadhan ...

Help with applying exception in preg_replace

Hello How can I can I allow only digit [^0-9] and a minus sign in front the digit. Example : Valid = -1...-9, Invalid = --1-... ...

Splitting a string with multiple white spaces with perl?

I am trying to split a string with multiple white spaces. I only want to split where there are 2 or more white spaces. I have tried multiple things and I keep getting the same output which is that it splits after every letter. Here is the last thing I tried @cellMessage = split(s/ {2,}//g, $message); foreach(@cellMessage...

Can MSBuild run regex on my config files ?

MSBuild generates a configuration file for me. I would then like to replace certain strings in the file. Is this possible? Also, I use Visual Studio as well to build my project. Can I do the same thing from Visual Studio? Thanks! ...

regex to match only .gov tlds

I am trying to write a regex to grab an entire url of any .gov or .edu web address to make it into a link. currently have /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ all in () so i can regurgitate it, for ANY URL...but I only want .gov or .edu ones. thanks in advance. ...

Controlling Word Wrap in a container

I have a peculiar problem. I have an email group that pipes emails to a message board. The word wrap of the emails varies. In yahoo, the messages tend to fill the entire container on the message board. But in all other mail clients, only part of the container width is filled, because the original mail was wrapped. I want all of the email...

Configure Django URLS.py to keep #anchors in URL after it rewrites it with a end /

In my django application I have my URLS.PY configured to accept requests to /community/user/id and /community/user/id/ with: url(r'^(?P<username>[\w-]+)/(?P<cardId>\d+)/$', 'singleCard.views.singleCard', name='singleCardView'), I did this as some times people will add an ending "/" and I didn't want to raise a 404. However parts of my...

Is something wrong with my regex?

Hi I made an XML Schema and I have this in it. <xs:element name="Email"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"/> </xs:restriction> </xs:simpleType> </xs:element> Some of my emails in one of my XML documen...

Regular expression to extract data inside an html code php

hello, how can i extract the data inside this html code <dl class="col1"> <dt>Type:</dt> <dd><a href="/browse/102" title="More from this category">Audio &gt; Audio books</a></dd> i need to extract the Audio > Audio books from the html code using regex in php ...

perl how to regex parts of data instead of entire string and then print out a csv file

I have a working perl script that grabs the data I need and displays them to STDOUT, but now I need to change it to generate a data file (csv, tab dellimited, any delimiter file). The regular expression is filtering the data that I need, but I don't want the entire string, just snippets of the output. I'm assuming I would need to store ...

Phone number regex for multiple patterns in Java

I need help writing a regex for a phone number pattern that allows the following formats for a phone number 1)###-###-#### or 2)#-###-###-#### or 3)###-#### or 4)########## or 5)####### I am well aware, that you are able to find regex patterns on the internet, but I havent been able to find one that will pass for all these patter...

regex breaking Chinese string

When i run this code and similar some Chinese the ni (你) character (maybe others) gets chopped of and broken. $sample = "你不喜欢 香蕉 吗"; $parts = preg_split("/[\s,]+/", $sample); var_dump($parts); //outputs array(4) { [0]=> string(2) "�" [1]=> string(9) "不喜欢" [2]=> string(6) "香蕉" [3]=> string(3) "吗" } //in 我觉得 你很 麻烦 //out ...

Please Specify the Correct Regular Expression

I wish to retrieve data between <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EBEBEB"> and </table> using Php.Can any one please specify me the correct regular expression for retrieving data between the given table tags ...

Regex: Match html tag only if it contains a specific class id

Match an html tag using perl regex in php. Want the tag to match if it contains "class=details" somewhere in the open tag. Wanting to match <table border="0" class="details"> not <table border="0"> Wrote this to match it: '#<table(.+?)class="details"(.+?)>#is' The <table(.+?) creates a problem since it matches the first table tag ...

Regular Expression to retrieve anchor

I have bunch of html and I need to get all the anchors and the anchor value using Regular Expression. This is sample html that I need to process: <P align=center><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10px"><SPAN style="COLOR: #666666">View the </SPAN><A href="http://www.google.com"&gt;&lt;SPAN style="COLOR: #666666">online versio...

how to built regular expression to get value between two single quotes and if there is no single qoute, extract between commas

Problem that i face: -I have an input string, a SQL statement that i need to parse -extract the value that need to be insert base on the column name specify -i can extract the value that is wrap in between 2 single quotes, but: --?what about value that has no single quotes wrap at them? (like: integer or double) --?what if the value...

RegEx modify Backreference's value

Is there a way to modify the value of a backreference? Example: In the following Text "this is a test" the word 'test' should be extracted and inserted into another text via backrefrence. Regex: (test) Replacement: "this is another \1" That works fine so far. But now the question is, if it is possible to modify the backreferen...

How do I extract all matches with a Tcl regex?

hi everybody i want solution for this regular expression, my problem is Extract all the hex numbers in the form H'xxxx, i used this regexp but i didn't get all hexvalues only i get one number, how to get whole hex number from this string set hex "V5CCH,IA=H'22EF&H'2354&H'4BD4&H'4C4B&H'4D52&H'4DC9" set res [regexp -all {H'([0-9A-Z]+)&} ...

how can i replace struts1 <logic:match>tag in struts2?

hi all in struts1, this is <logic:match> tag to use [Regular Expression]. how can i use the function in struts2 tag ? for example, i want to check a string begin with 'AA', <s:if test=""> The string begin with 'AA' </s:if> Thank you ...

php regexp for get images

Possible Duplicate: Regex to change format of all img src attributes Hi, I want to replace the image path in my content db field. I have the following preg_replace("/src='(?:[^'\/]*\/)*([^']+)'/g","src='newPath/$2'",$content); which is working fine for src="/path/path/image.jpg" BUT fails ON src="http://www.mydomain....