306 Topics
| |
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 … | |
| 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? … |
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? | |
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 … | |
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 | |
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 | |
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 … | |
how do I do pattern matching for something like `/^(.*)text/` and `/text(.*)$/`? | |
Hi i want pattern for checking no white space. | |
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 … | |
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 … | |
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 … | |
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 | |
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; … | |
Can any one help me to convert wildcard pattern into regular expression pattern using c#.Net...? | |
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 | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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) … | |
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:_@/- | |
regular expression that accept only letters OR numbers. | |
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 … | |
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 … | |
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 … |
The End.