306 Topics

Member Avatar for
Member Avatar for Reverend Jim

Sometimes you want to add a little functionality to an existing class but you don't want to go to the trouble of sub-classing. A technique that you can use is known as **Extending**. For example, I frequently use regular expressions when working with strings. Wouldn't it be nice if strings …

Member Avatar for ddanbe
1
379
Member Avatar for [NOPE]FOREVER

1. Exactly what are regex? 2. Do we write them ourselves or are they prdefined expressions? 3. If we can write regex ourselves, how do we write them? 4. How do they check for invadalities? For example the email regex: [-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]{2,4} how does this expression check for valid email addresses? …

Member Avatar for pritaeas
0
168
Member Avatar for dawbin

I'm trying to extract an array of "<div>" and I am confounded by why this these two patterns work... preg_match_all('/<div class="date">.*?/m',$htm,$a); preg_match_all('/<div.*?</div>/m',$htm,$a); But this one does not return anything... preg_match_all('/<div class="date">.*?<\/div>/m',$htm,$a); Is there some regular expresion magic I am missing?

Member Avatar for dawbin
0
254
Member Avatar for fedaa91

Hi i tried this regular expression `^(?:\00|9)[. ()-]*(?:\d[. ()-]*){8,14}$ `to enter a phone number in a text field ,but it didnt work like i wanted . what i want the rule to be is if the phone number starts with 9 then the length would be 8 digits, but if …

Member Avatar for fedaa91
0
343
Member Avatar for silverdust

I have tried a written a code like so re.findall(r'[A-Z]{3}[a-z][A-Z]{3}',string) to find the solution for this python challenge http://www.pythonchallenge.com/pc/def/equality.html it seems so hard to figure out. I'm getting 527 matches and none takes me to the next level. Help or close hints will be appreciated

Member Avatar for silverdust
0
437
Member Avatar for silverdust

I have been stuck on this python challenge http://www.pythonchallenge.com/pc/def/ocr.html . I am familiar with python re module and regex but I don't seem to get what the challenge wants me to do. If there's anyone else that has been there, I'll need some help

Member Avatar for silverdust
0
381
Member Avatar for prem2

Dear team, I am facing difficulties to validate the below format. I want regular expression needs to be satisfied with the below condtion. $pattern = '/^\w[\w\s\.\%\-\(\)\[\]]*$/u'; $file_name = "(00)filename.jpg"; if(preg_match($pattern,$file_name)){ echo "Pattern matched"; }else { echo "Pattern not matched"; } I have tried several ways. But, the main problem is …

Member Avatar for ko ko
0
280
Member Avatar for nouth
Member Avatar for nouth
0
156
Member Avatar for Ashok_121284
Member Avatar for nouth

how to `.replace()` the `'error'`? only use `a` and `b` var str = 'bla bla anything error anything bla bla'; var a = 'anything', b = a; im not good with regular expressions so im asking for how to do this with variables so i can set them up all …

Member Avatar for diafol
0
7K
Member Avatar for jazzermonty

Hi guys I've written a very simple program that reads in some files, does some cleanup on the data and then creates a sql statement to insert the data into a table. Now I have 125 of these fies of varying sizes and on some (not all) of the files …

Member Avatar for jazzermonty
0
318
Member Avatar for prashant9928

Hi there, I am working on a project and want to resolve invalid form submition. i want to create a regular expression which can check each form value that must not have any string like as: '"abc.Xyz What exactly the regular expression should be?, for more information please feel free …

Member Avatar for Reverend Jim
0
388
Member Avatar for reygcalantaol

Hope somebody can help me regarding regular expression. I have a shortcode format "<!--myproductsku-->" in the string, I want to use regular expression to extract myproductsku. And if there is a match replace "<!--myproductsku-->" with "This is my myproductsku.". Rey

Member Avatar for Daemon_CC
0
267
Member Avatar for Kristian_2

I have solved it... Shame... -------------------------------- I have problem with this code: cin >> str; smatch m; regex e("([[:w:]]+)@([[:w:]]+)\.com"); //<- Here was the error (it was regex e("([[:w:]+)@([[:w:]]+)\.com");) silly me :(( bool found = regex_search(str, m, e); cout << "m.size() " << m.size() << endl; for (int n = 0; …

0
149
Member Avatar for RohanSpi

Can any one help me to convert wildcard pattern into regular expression pattern using c#.Net...?

Member Avatar for RohanSpi
0
180
Member Avatar for Varunkrishna

Hi all I have a textarea I would like to validate the same for empty spaces and on no input. Please find my jsfiddle [here](http://jsfiddle.net/Varun_Krishna/jJh8q/). How do I validate for empty spaces in the text area? what am I missing in my fiddle? Thanks Varun Krishna. P

Member Avatar for Varunkrishna
0
2K
Member Avatar for AwkRocks

Hi Friends. I am trying to conver the following grep syntax to replace using awk pattern match. Can you please help? tail -F $logFiles | grep " ERROR " | grep -v 'ERROR_SERVER \|Session is null for endpointId\|SYNCED_IN_VIEW_UPDATED'| cut -d" " -f10-14 | awk 'BEGIN..............}' I am seeing some buffering …

0
148
Member Avatar for Rizi004

Hello everyone i have a pattern that checks the given url is correct or not and this is working perfectly fine, but when i give arabic chrarcters in pattern it return false because of invalid URL. I want english and arabic chracter to check in URL. where i can do …

Member Avatar for diafol
0
1K
Member Avatar for kannan mangalar

i need a regex for ectract meta title, description exg: <meta name="description" content="xxxxx"> and <meta name="Description" content="xxxxx"> and <meta name="Descriptions" content="xxxxx"> and <Meta name="Descriptions" content="xxxxx"> and <META NAME="Description" content="xxxxx"> i want to extract all type od descrptions, same also meta title

Member Avatar for diafol
0
518
Member Avatar for deadsolo

Hello Everyone, As the title implies I need help extracting a name out of a string, my knolwedge of regular expressions is pretty limited. The strings I will be working with will look like this: 12345 Aragon Denvil L. 123-1234 A123456 AragonD AragonAD@fake.mail.us 1000001234 ABC-ABC 123ABCD123 ABCD 1234 A1234 ABC12345A1 …

Member Avatar for deadsolo
0
613
Member Avatar for Sagarnil

I have a difficult problem. I know there are so many 're' masters in python out there. So please help me. I have a huge log file. The format is something like this: [text hello world yadda lines lines lines exceptions] [something i'm not interested in] [text hello world yadda …

Member Avatar for Lucaci Andrew
0
803
Member Avatar for Master Mascus

Hello guys, I am having a problem with a regular expression in my jquery validation. Can someone help me please. The method : $.validator.addMethod( function (value, element) { /^[A-Z]{1}\d{12}[A-Z0-9]{1}$/.test( value ); }, "Invalid NIC." ); An example of the NIC field : L261089652789A or L2610896527897

Member Avatar for pritaeas
0
258
Member Avatar for dinhunzvi

i have a function which is supposed to check if a number is a floating-point number. this is the structure of the function function isValidFloat( $string ){ if( !preg_match( "/^[0-9]+(.[0-9]+)?$/", $string ) ){ return false; } } for numbers such as 1 or 8 it's correctly validating but not for …

Member Avatar for pritaeas
0
226
Member Avatar for bops

I've been having tonnes of issues with Mod Security. I am busy writing a CMS for a project at work and while developing a page to edit a certain database record I kept getting 403 errors. After hours of banging my head against my desk, adjusting bits of code I …

Member Avatar for bops
1
988
Member Avatar for srinu_1

hi, **please help me to solve the error for:** **text1.txt:** line1 <data> line2 <items> line3 <match name="item1" rhs="domain.com"></match> line4 <match name="item2" rhs="domainn.com"></match> line5 <match name="item2" rhs="1010data.com"></match> line6 </items> line7 </data> **text2.txt:** line1 djshjsdf line2 sdfngjfg check domain.com,domain.com,1010data.com in text2.com, if not there print domain.com,domain.com,1010data.com in to the 3rd text file(text3.txt) …

Member Avatar for snippsat
0
372
Member Avatar for abhijit_2

Create a username that's at least 6 characters.It may include uppercase and lowercase letters. Usernames are case-sensitive. It also must include either:at least one number; or one of these symbols:_@/-

Member Avatar for deceptikon
-1
135
Member Avatar for abhijit_2
Member Avatar for deceptikon
0
119
Member Avatar for Yorkiebar14

Hello, I am trying to extract ALL strings between two apostraphes within a given string but for some reason I only seem to be getting the first one. The string I am trying to extract from is: `'1962' '1963' '1964' '1965' '1966'` The code I'm trying to use to get …

Member Avatar for Troy III
0
231
Member Avatar for suncica2222

I need regex for parsing phpbb forum style quote tags, general case with preserved items order. Like quoted, unquoted, quoted, quoted, quoted... etc... Also there are NOT NESTED quotes. I'll explain on example. some unquoted text11 [quote="person1"]some quoted text11[/quote] [quote="person2"]some quoted text22[/quote] [quote="person3"]some quoted text33[/quote] some unquoted text22 ... [quote="person4"]some …

Member Avatar for pixelsoul
0
349
Member Avatar for SCass2010

Hi all, Wondering if anyone could help - I have a project I'm working on - part of it involves loading a list of resource files at runtime. I can hardcode each file and use the ClassLoader.getResource("....") to get each file, but I was wondering is there a way to …

Member Avatar for JamesCherrill
0
202

The End.