Arguments with regex
I would like to know how to split this string: command arg1 arg2 arg3 In this array: [arg1,arg2,arg3] BUT if the user types: command "arg1 still arg1" arg2 The array will be: [arg1 still arg1, arg2] Using PHP ...
I would like to know how to split this string: command arg1 arg2 arg3 In this array: [arg1,arg2,arg3] BUT if the user types: command "arg1 still arg1" arg2 The array will be: [arg1 still arg1, arg2] Using PHP ...
I have a regular expression that returns us and canada zipcodes as follows. ((?<US>\d{5})|(?<Can>\b[A-Z-[DFIOQUWZ]]\d[A-Z-[DFIOQU]]\ +\d[A-Z-[DFIOQU]]\d\b)) I need to do this in java script or jquery. An application that can extract only these values. For example someone could simply paste a document into the textarea, click a butto...
Hello Please help with below I need match only words where counting of characters same for example same counting for a b c abc ///match 1 (abc) aabbcc match 2(abc) adabb not mach 2(ab) ttt match 0(abc) ...
I am looking for a good .NET regular expression that I can use for parsing out individual sentences from a body of text. It should be able to parse the following block of text into exactly 6 sentences: Hello world! How are you? I am fine. This is a difficult sentence because I use I.D. Newlines should also be accepted. Number...
Dear all, several months ago, you provided a perfect solution for my IsAlpha & co issues. But once again, I ran into issues after upgrading PHP (to version 5.2.9), although the ctype_* functions seem to do their job now: ctype_alpha( $value ) /* VS */ preg_match("/^[\p{L} _.\-]+$/u", $value) ctype_alnum( $value ) /* VS */ preg_matc...
After finding the fastest string replace algorithm in this thread, I've been trying to modify one of them to suit my needs, particularly this one by gnibbler. I will explain the problem again here, and what issue I am having. Say I have a string that looks like this: str = "The &yquick &cbrown &bfox &Yjumps over the &ulazy dog" You'...
The file i am working with (oraInst.loc) looks like this: inventory_loc=/u01/app/ORAENV/oracle/oraInventory inst_group=dba I need to use a regular expression to grab the value between app/ and /oracle. In this case it will be ORAENV but it could be any alphanumeric string of any case and length but with no spaces. From what I have re...
Hello there, I need help regarding Regular Expression to find a tag/code called 'WAITPHOTO' in a document text. Depending on the presence of WAITPHOTO tag, I will be wrapping text around an Image(left/right of image). FYI, All the tags starting with PHOTO will be replaced by Image at run-time. I have some text that looks like: Steps f...
While testing my Google App Engine application, I search for links which include app engine keys. For example: /story/ag5yZXBsaWUtdGVzdGluZ3IMCxIFU3RvcnkY-w0M/ What characters are allowed in these keys? I had been using the regex [a-zA-Z0-9], but it seems "-" is also allowed. What else? Is there a reference on this? I can't find it i...
Hi, I'm writing a web application in Rails which uses sqlite. I want the user to be able to search a table in the database by using a regex. Is this possible? Thanks. ...
I am checking a string with the following regexes: [a-zA-Z0-9]+ [A-Za-z]+ For some reason, the characters: . - _ are allowed to pass, why is that? ...
Hello guys i am trying to get the text inside specific <td's>. Each one has a id="uniqueName" - Such as: <td id="engineTypeField" class="normal2" colspan="2"> 3.0L L6 SFI DOHC</td> but i am having bad luck - learning regexp as doing so This is what i have: preg_match ("<td id='\/engineTypeField\/(.*)>(.*)</td>i", $result, $matches); /...
In my controller, I current set a constraint that has the following regex: @"\w+" I want to also allow for underscore,dash and period. THe more effecient the better since this is called allot. any tips? ...
Ok so I finally figured out that I need the following: So the regular expression has to perform: alphanumeric at least 1 letter must have between 4 and 8 characters (either a letter/digit). i.e. an alphanumeric string, that must have at least 1 letter, and be between 4-8 in length. (so it can't be just all numbers or just all letter...
(The background for this question is that I thought it would be fun to write something that parses wiki creole markup. Anyway the problem that I think I have a solution to is differentiating between // in a url and as opening/closing syntax for italic text) My question is slightly compound so I've tried to break it up under the headings...
The data I need to parse looks like: [fild1, filed2, .... filedn] , [filed1, filed2, .... filedn] ..... I call it a special form of CSV data because there are two kinds of comma: those commas outside the [] pair are served as the separator between different records. those commas inside the [] pair are served as the separator betwee...
Is there an accepted way to deal with regular expressions in Ruby 1.9 for which the encoding of the input is unknown? Let's say my input happens to be UTF-16 encoded: x = "foo<p>bar</p>baz" y = x.encode('UTF-16LE') re = /<p>(.*)<\/p>/ x.match(re) => #<MatchData "<p>bar</p>" 1:"bar"> y.match(re) Encoding::CompatibilityError: incompa...
There's a PCRE regex for extracting URLs posted here: http://daringfireball.net/2009/11/liberal_regex_for_matching_urls \b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))) What would need to be changed to make it compatible with regex in .NET? ...
I have a string of text (about 5-6 words mostly) that I need to convert. Currently the text looks like: THIS IS MY TEXT RIGHT NOW I want to convert it to: This Is My Text Right Now I can loop through my collection of strings, but not sure how to go about performing this text modification. ...
Okay, this is the problem: I am getting this error message when I am trying to run the following script Dim rg Dim match Set rg = New RegExp rg.Pattern = "Mod Read Access" rg.Global = True roles = Session("Roles") Set match = rg.Test(roles) it chokes at the rg.Test(roles) point. I suspect that I may be doing something wrong sinc...