269 Topics

Member Avatar for
Member Avatar for Dani

I've been really struggling with regex lately ... I never quite got the hang of it. I'm currently hung up on trying to match on the following in my .htaccess file: ^foo/([A-Za-z0-9]+)/([0-9]+)$ The catch is that I want the alphanumeric string to *NOT* be one of a short list of …

Member Avatar for BigPaw
0
199
Member Avatar for samiyahg

Hi, I need help in writing a regular expression accoding to the following criteria: preg_match (keywords tel/contact/phone/phne/telephone which can be found anywhere in the string) followed by 7 int(numbers). Thnx, Regards, Sami

Member Avatar for samiyahg
0
203
Member Avatar for divyakrishnan

Hi... I am using following query to get data from a table *select * from emp where ename regexp 'rajkiran'* It will return only the rows with ename=rajkiran but I want to select all the rows with ename =raj kiran & ename=rajkiran using a single query

Member Avatar for pritaeas
0
149
Member Avatar for Dino000

Hello. I've been through dozen of tutorials about regex, and obviously still don't understand everything. I'm trying to get data (a whole DIV field and its contents) from another website, and display it on my page. It seems to get everything, but the DIV field. This is what I want: …

Member Avatar for LastMitch
0
292
Member Avatar for deadsolo

Hi, I need help creating or manipulationg my current regex that will grab two numbers from a line, while excluding a specific number. Here is an example of what the line will look like: "In our tests, downloads on port 6881 achieved up to 12059 Kbps while downloads on port …

Member Avatar for deadsolo
0
180
Member Avatar for dancks

I am making a basic craigslist type website with a search function. There is a field where you can enter what you think the name of the product might be and my search function is supposed to find names of products that match. so for example a user can enter: …

Member Avatar for diafol
0
339
Member Avatar for daniel36

i am having the code if (eregi($file,$_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) $use_lang = $file; This line of code is giving error:-Deprecated: Function eregi() is deprecated in C:\xampp\htdocs\spm\includes\header.php on line 15

Member Avatar for pritaeas
0
155
Member Avatar for deadsolo

Hi, I am currently working on a script that will compare two numbers from a file. I am thinking that I need to use a regular expression in order to get the numbers, however I don't know what the regex would be since there are multiple numbers through out the …

Member Avatar for deadsolo
0
293
Member Avatar for jamojo

Hello Everyone. Can you please advise how can I replace a string from this "[" to "]" this character and replace it with blank string? I believe I will use str_replace but I am having a hard time doing this. The quick brown fox jumped over [caption id="attachment_223" align="alignleft" width="900"] …

Member Avatar for jamojo
0
162
Member Avatar for klemme

I have this pattern which finds links, inside a text string from file_get_contents function. Works fine, it seems. But I am curious to understand the expression, each charachter of it, what it does etc. Here you go: preg_match_all('~href=("|')(.*?)\1~', $var, $out); I know what it does obviously, but what does (.*?)\1~ …

Member Avatar for klemme
0
182
Member Avatar for divyakrishnan

Hi.. I used following regular expression "/^[0-9]{1,2}\-\[0-9]{1,2}\-\[0-9]{4}$/" for email validation. It won't check the mail id like "testmail@gmail" . It will work "testmail@gmai" Can anybody suggest solution for this?

Member Avatar for pritaeas
0
79
Member Avatar for krystosan

Hello I am trying to build a function that i can use in to search for an object or item from its name, Here is what I have in **sfind.py** def findobj(searchTxt,items): """ This function will help you find an object or an item from list of items passed to …

Member Avatar for krystosan
0
154
Member Avatar for pritaeas

Recently bought "Regular Expressions Cookbook 2nd ed." and wanted to share my findings. The book is divided into two parts. The first part (3 chapters) describes tools, skills and programming. The tools chapter shows you what's out there (including his own software). The skills chapter is a tutorial. It describes …

Member Avatar for pritaeas
1
245
Member Avatar for kshahnazari

I have a simple question about regular expression and Im new to php so sry about my bad questions , what is the meaning of ^ and $ in regular expression and please give examples that if we dont put them it will go wrong . thank you

Member Avatar for kshahnazari
0
160
Member Avatar for Ghost

Hi guys! I've been using PHP for fun for a while, and now I'm interested in playing with some scraping. I know regex is the way to go. So I'm trying to scrape a page of 4chan. I want to grab the images and the title of the thread of …

Member Avatar for diafol
0
238
Member Avatar for diafol

Hi all. AM having a little issue with regex. Not one of my strongest skills! I'm trying to produce a simple translation system that doesn't require arrays, gettext etc. It basically has this structure: $content=<<<CONTENT <p>{{Dyma destun||Here's some text}}</p> ... CONTENT; So the page content is held in a var …

Member Avatar for diafol
0
310
Member Avatar for caven.chunyen

Hi, I've got a set of folders with each contain many files. I need to extract a specific file extention(.sof) from each of these folders to a new directory(or the same directory in a new folder). Any help is appreciated. Thanks.

Member Avatar for extension wpd
0
294
Member Avatar for grant.baker

Hi I'm working on a form validation script. Up to this point, I've only written very basic regex validations. The input that I'm trying to validate should have entries in the following format AAA111 separated by comma space. So some sample entries are : `ABC111` or `ABC111, ABC112, ABC113`. Here's …

Member Avatar for grant.baker
0
284
Member Avatar for sarelnet

Hi, I have a HTML page in one variable. I need build a mehod that will extract a tag content (dif extract_tag(self, tag_name)). For example, given webpage: <div id="mw-page-base" class="noprint"></div> <div id="mw-head-base" class="noprint"></div> <!-- content --> <div id="content" class="mw-body"> <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice …

Member Avatar for ryantroop
0
249
Member Avatar for prakash89.gitam

Hi I have a task to do. I will just brief it in a sentence, I have a file of 20000 lines. Now task is to recognize number of similar lines. ex1 : "The quick brown fox jumps on a lazy dog" ex2 : "The quick brown dog jumps on …

Member Avatar for Taywin
1
170
Member Avatar for notconfirmed

Hello, I have a problem to this html code.I want to get only the data inside the href,but the data is dynamic. <a title="Click here to see docket information" href="/ccm/do/docket?county=65&amp;data=eedd78d10fd9da341e05b25b48b62013">652012CC000006CCXXXX</a> I am not really familiar in regex.I am using this code to extract the html inside the href. MatchCollection m1 …

Member Avatar for Mike Askew
0
1K
Member Avatar for arcticM

I wanted to validate a string with preg_match but after a lot of struggle I just used if($str[0]!='x'.... but just out of curiosity I wonna know how to do this using preg_match I'm getting a string as an input- the 1st char in the string must be % the 2nd …

Member Avatar for arcticM
0
152
Member Avatar for aint

Hi, I am working on Protein and DNA sequences. When you have a protein sequence it can be translated in to DNA sequence in many ways. A nice way to express this is using regular expression. I would like to create this long regular expression for a protein sequence, and …

Member Avatar for TrustyTony
0
317
Member Avatar for ramya_nd

do you know how can i put a hyphen (-) after 3 digits of a number(starting from the end) in php? example: the number 9787897878 to be shown as 978-789-7878??

Member Avatar for ramya_nd
0
120
Member Avatar for chrishea

I'm not very familiar with Javascript or Regex but I built a script that is working well with one small flaw in the Regex part. What I want to do is to find commas following alpa-numeric characters (actually almost anything other than a double quote) and then replace the comma …

Member Avatar for pritaeas
0
279
Member Avatar for keval007

Hi, I have text file which has lots of text as well as HTML data. There are some line as shown below. 06/30/12 00:40:30.73 Sending Email - Group: 4FD7917824F1B-EMAIL, 0, Message: There are lots of lines like above in text file. I want to extract following data from the entire …

Member Avatar for diafol
0
101
Member Avatar for diafol

Hi all. Am having a senior moment here. I have a htaccess file thus: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)/*([^/]*)/*([^/]*)/*([^/]*)/*([^/]*)/*$ index.php?lang=$1&top=$2&middle=$3&bottom=$4&sub=$5 [L] Which basically allows me to show http://www.mysite.com/cy/tgau/cemeg-1/ for http://www.mysite.com?lang=cy&top=tgau&middle=cemeg-1 That's all well and good. However, I'm getting real problems directing my forms to /includes/login.php This …

Member Avatar for cereal
0
224
Member Avatar for missil9

Hey all, I usuallly don't like asking for help on these sites but I have been kicking myself for a while now implementing boost regex for a program (i have never had any prior issues). I believe the issue is with my regex syntax but i have tried numerous variations …

Member Avatar for missil9
0
315
Member Avatar for patocardo

I cannot find the mistake in the following code function doArray(n){ // test with n > 1000 var str, i, j,arr=[], cnt=0, q=0, re; str = ["one two three","two three four","three four five", "four five one", "five one two"]; for(i=0; i<n; i++){ j = Math.round(Math.random()*(str.length-1)); arr.push(str[j]); } re =/two/g; for(i=0; …

Member Avatar for Airshow
1
128
Member Avatar for iamthesgt

I am using Awk inside a bash shell script to search header files for c++ functions so I can add these functions to another file. All of the functions I need will have form: type getName() or type setName(type value) Right now I get all the functions listed in between …

Member Avatar for iamthesgt
0
448

The End.