First of all sorry for my bad english. I'm a german guy.
The code given below is working fine in PHP:
$string = preg_replace('/href="(.*?)(\.|\,)"/i','href="$1"',$string);
Now T need the same for sed. I thought it should be:
sed 's/href="(.*?)(\.|\,)"/href="{$\1}"/g' test.htm
But that gives me this error:
sed: -e expression #1...
Hi,
I'm trying to do this little something into one of my CKEditor plugins:
onOk:function(){
var sInsert=this.getValueOf('info','insertcode_area');
if ( sInsert.length > 0 ) {
regex = new RegExp('(?<=\?v=)([-a-zA-Z0-9_-]+)', 'gi');
url = 'http://www.youtube.com/v/'+sInsert.match(regex);
sInsert = '<object type="...
I'm trying to validate date using PHP.
I'd like following formats to be valid:
d/m/yy
d/m/yyyy
dd/m/yy
dd/m/yyyy
d/mm/yy
d/mm/yyyy
dd/mm/yy
dd/mm/yyyy
I've tried many regular expressions and different variations of checkdate() function. Currently I have something like this:
function _date_is_valid($str)
{
if(strlen($str) == 0)
...
Hello,
I got a system that only accepts regular expressions for matching and since I've never done it before I went on-line to lookup some tutorials but got really confused so I'm asking here.
Regular expressions needs to match the following:
File.f
File-1.f
in both cases it has to return what's before the . or - in the 2nd case (Fi...
Hi ,
I need to delete a matching substring when found in string 1 ignoring whitespaces and charcters like -.
The example I have is:
string 1="The LawyerWhat happened to A&O's first female partner?The LawyerWhen Clare Maurice was made up at Allen & Overy (A&O) in 1985 she was the sole female partner at the firm. Twenty-five years later...
I can't seem to get a handle on what this expression intends to extract:
preg_match("/^(?:[\s\*]*?@([^\*\/]+?)\s(.+))/",$line,$match);
$line is a line from a text file while $match is an array
...
How do I change a period/dot (.) into a plus (+) of a match using mod_rewrite? My match is #2.
This is my rule so far:
RewriteRule ^(.*)/(.*)-[0-9]*\.shtml$ http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=$2 [L,R=301]
With my rules currently,
http://media.www.kentnewsnet.com/media/storage/paper867/news/20...
Hi All,
I want to find all the words enclosed within a {} using a regular expression.
If my string is 'The Insured Addr {Address} is not valid for {Name}',
I want to pull out only 'Address' and 'Name' . I have been trying for couple of hours without success.
Any help is really appreciated.
I tried ([/{]([a-zA-Z0-9 ]*)[}])
Thi...
Possible duplicate: http://stackoverflow.com/questions/299942/regex-matching-html-tags-and-extracting-text
I need to get the text between the html tag like <p></p> or whatever. My pattern is this
Pattern pText = Pattern.compile(">([^>|^<]*?)<");
Anyone knows some better pattern, because this one its not very usefull. I need it to...
How can I match strings without a dot in regex, for example, these should be matched:
a/b
אאא/תתת
a
b
c
ג
123/1
but these shouldn't:
abc.asp
ddd.css
style/main.css
For .NET Syntax. Thank you.
...
Hi There
I am hoping that someone can help me, I am using Javascript and asp
I have this string /folder1/folder2/pagename.asp
I need a regex to strip the /pagename.asp from the string
pagetype.replace(/\/.*?\.asp/ig, '');
The regex above is halfway there but the problem is that it strippes from the beginning / everything between th...
I'm trying to split a string with text into words by using the php-function preg_split.
$words = preg_split('/\W/u',$text);
It works fine except for swedish chars lite åäö. Doing utf8_encode or decode doesn't help either. My guess is that preg_split only works with single byte chars and that the swedish chars are multibyte. Is there a...
I got a file that looks like
dcdd62defb908e37ad037820f7 /sp/dir/su1/89/asga.gz
7d59319afca23b02f572a4034b /sp/dir/su2/89/sfdh.gz
ee1d443b8a0cc27749f4b31e56 /sp/dir/su3/89/24.gz
33c02e311fd0a894f7f0f8aae4 /sp/dir/su4/89/dfad.gz
43f6cdce067f6794ec378c4e2a /sp/dir/su5/89/adf.gz
2f6c584116c567b0f26dfc8703 /sp/dir/su6/895/895.gz
a864b7...
I have database records in the form of 10 character long strings, such as 4085551234.
I wish to format these into this format: (408) 555-1234.
I think this is regex related. I'm new to programming and completely self-taught here, so any sort of resource relating to performing text processing would be appreciated as well. Thanks!
...
hi
somewhat confused.. but trying to do a search/repace using wildcards
if i have something like:
<blah.... ssf ff>
<bl.... ssf dfggg ff>
<b.... ssf ghhjj fhf>
and i want to replace all of the above strings with say,
<hh >t
any thoughts/comments on how this can be accomplished?
thanks
update (thanks for the co...
Given the string (or any length string with an even-number of word pairs):
"12345678"
How would I swap adjacent "words"?
The result I want is
"34127856"
As well as, when that's done I need to swap the longs.
The result I want is:
"78563412"
...
Hello guys,
i'm doing the simplest regex.match ever, i am giving the Regex.Match a pattern of one character and it returns no match at all, and i made sure the input text contains a lot of that character?
i checked all the usings.
its just very weird.
any help would be appreciated!
Thanks.
EDIT:
my sample is "doing any type of mat...
Came across this handy regular expression utility in Python (I am a beginner in Python). e.g. By using the regexp
(?P<id>[a-zA-Z_]\w*)
I can refer to the matched data as
m.group('id')
(Full documentation: look for "symbolic group name" here)
In Ruby, we can access the matched references using $1, $2 or using the MatchData object...
Hello,
I want to parse a HTML code and create objects from their text representation in table. I have several columns and I want to save context of certain columns on every row.
Now, I have the HTML code and I understand I should use Pattern and Matcher to get those strings, but I don't know how to write required regular expression.
T...
I want a regex in such a way that to replace the filename which contains special characters and dots(.) etc. with underscore(_) except the extension of the filename.
Help me with an regex
...