Hey Guys, So I have a JTextfield in the cells of 1 of the columns in my JTable I want to allow only numbers and up to one dot/period. Doesant need to contain a period. The persiod can be anywhere except at the end of the number. 1 ok .1 ok 1.1 ok 1.1.1 not ok 1. not ok This is my expression in my code Currantly it allows only numbers which is good, but it doesant allow any periods, :(... private JTextField createTextField() { JTextField field = new JTextField(); ((AbstractDocument) field.getDocument()).setDocumentFilter(new DocumentFilter() { @Override public void insertString(FilterBypass fb, int …

Member Avatar
Member Avatar
+0 forum 23

Hello, I'm hoping for some help with a regex that has me stumped. My skill with regex is rather rudimentary. To start, here are a couple of example URLs, and whether I want to match them or not: collection/col1 // MATCH collection/col2 // FAIL collection/col1/products/pro1 // FAIL My criteria: * One single regex (cannot be multiple expressions) * I have a list of "col"s to fail on. For example, I do not want to match if specifically "col2" or "col3" are in the URL * Aside from col2 or col3, i can have any col[#] in the URL * Even …

Member Avatar
Member Avatar
+0 forum 4

**The Problem:** I have a long string of serial numbers, that looks like this: "1_2_3_4_5 0_100_1_0_4 1_2_3_4_5 0_100_1_0_4 0_100_1_0_4 3_1_34_5_6"; I want to remove all serial numbers that do not occur EXACTLY 3 or 1 times in the string. **The Result:** In this case the return string should be: 0_100_1_0_4 0_100_1_0_4 0_100_1_0_4 3_1_34_5_6 **The question:** How can I use pure regex in php to remove all serial numbers that do not occur 3 or 1 times. I do not want to use array unique or array_count_values as they are too slow when dealing with large amounts. Pure regex is faster …

Member Avatar
Member Avatar
+0 forum 30

I am not a computer professional, only like to develop my own toys. I am using Globi Flow to get the info I need from the XML file. All is done, except for one instance where I do not have the closing tag Regular node with closing tag: <proper price>$4</price> Below is the code used for all data extraction. preg_match_all_gf("/<city>(.*?)<\/city>/ism", [(variable)token],4) This would get the 4th occurrence. And this is what I currently need and it does not have the closing tag: <comp score:"9.0"> I managed to get the first digit (in the example above, 9) using Regex, as it …

Member Avatar
Member Avatar
+0 forum 7

Suppose we need to populate and filter a Datagrid with the data coming from an Access table. It could be of course a table from Sql Server also. Form dataGridSelect contains two buttons and a DataGridView. Clicking the first button will populate the DataGridView the data comming from a Sql Server database. The second button does the same comming the data from an Access database. Nothing new, but once the data is fetched a Linq filters through a Regex pattern. The pattern "[^d|D]ata" tells to select the rows where the field Title has the sequence 'ata', not those [^d|D] preceeded …

Member Avatar
+0 forum 0

Hi im im trying to get attributes from two diffrent tag names.. <img class="chimg" alt="SOME TEXT" src=" #1 IMAGE LINK TO GET"/> <span>" #2 TIME TO GET" </span>" SOME TEXT "</a> </h3> <div> <a href=' #4 LINK TO GET' onclick="window.open('Some link'); return true;" title=' #3 TITLE TO GET' >SOME TEXT</a> I WANT TO PUT THESE IN ORDER FOR EACH LINK DataGridView1.Rows.Add(""IMAGE LINK"", ""TIME TO GET"", ""TITLE TO GET"", ""LINK TO GET"" ) this is what i have so far Dim ElementCollection As Windows.Forms.HtmlElementCollection ElementCollection = WebBrowser1.Document.GetElementsByTagName("a") For Each curElement As HtmlElement In ElementCollection DataGridView1.Rows.Add(curElement.GetAttribute("title"), curElement.GetAttribute("href")) Next Please help..

Member Avatar
Member Avatar
+0 forum 1

I've been Googling this one, and I've come across solutions, but they don't seem to work for me. The code is as follows: <?php $name1 = "Jack Random"; // true $name2 = "JackRandom"; // true $name3 = "Jack;Random"; // false $name4 = "JackRand;om"; // false // Accept only A-Z, a-z, 0-9 and space. if (!preg_match("/^[0-9a-zA-Z ]/", $name1)) echo "Nope, not good"; echo "<br />"; if (!preg_match("/^[0-9a-zA-Z ]/", $name2)) echo "Nope, not good"; echo "<br />"; if (!preg_match("/^[0-9a-zA-Z ]/", $name3)) echo "Nope, not good"; echo "<br />"; if (!preg_match("/^[0-9a-zA-Z ]/", $name4)) echo "Nope, not good"; // Tried: /^[0-9a-zA-Z ]/ // Tried: …

Member Avatar
Member Avatar
+0 forum 2

I have inputs in the form like below Data: 01 18 01 23 45 67 89 AB CD EF FE DC BA 98 76 54 32 10 01 23 45 67 89 AB CD EF 02 18 67 89 AB CD EF FE DC BA 98 76 54 32 10 01 23 45 67 89 AB CD EF FE DC BA 03 10 33 33 33 33 33 33 33 33 44 44 44 44 44 44 44 44 04 10 44 44 44 44 44 44 44 44 33 33 33 33 33 33 33 33 05 10 55 …

Member Avatar
Member Avatar
+0 forum 1

I have this regex ((?<!tpg-)assets\/[a-z\/\.](([^{]*?)\.(svg|jpg|png|gif|ico))) Which I use to replace asset source patterns in HTML or JS on with my build script.. It works, all but for one combination. The above regex fixed the situation, but wont work with V8 regex. Is there a work around? Take a look at https://regex101.com/r/zN5sG1/1 and toggle the flavour, PHP to JS.

Member Avatar
+0 forum 0

I've had a real good look around at it seems to be quite difficult, all I can find is ones that claim to work in PHP, I tried them anyway and get invalid groupings, escape sequnses etc... I cannot find one for C#. I do not have the ipv6 to use TryParse, I need to match an ipv6 in a string. Maybe someone has successfully made one or had better luck searching than me. Thank you for reading.

Member Avatar
Member Avatar
+0 forum 18

Group, I need to insert an "If/Then" statement that will require the command to check the string for multiple variables. In other words it needs to say something like this: If Microsoft.VisualBasic.Mid(txtLine, 18, 1) = "C" or "T" or "G" or "W" Then Go do something End If After doing some reading, it seems that "Regex" may be the way to correctly write this. However this is a new command to me and I'm not sure how to write something like this. Can you give me a hand? In advance, thanks for the help. Don

Member Avatar
Member Avatar
+0 forum 3

''' in Python 3.4 Attempting to parse and print one line (actually a number)from the downloaded code from yahoo sourecode using regex to pull the number that is located at the (.*?). I've tried everything I can think of to get this to work - I expect the problem is my coding somehow - any help appreciated!! :) ''' pbr = re.search(r'(Price\/Book \(mrq\):<\/td><td class="yfnc_tabledata1">)(.*?)<\/td>',str(respData)) print (pbr)

Member Avatar
Member Avatar
+0 forum 10

dear all, i am facing a problem. actually i wanna get user validation with the following code, I want to insert only [a-z0-9_] character in user login....when i insert username like this 'asdfdfad' it returns else part ( special characters are not allowed ). please solve it ..... thanks if ( preg_match ('/^[a-z0-9]$/', $username)) { echo $username. ' ' . $password . ' ' . $email; } else { echo 'special characters are not allowed'; }

Member Avatar
Member Avatar
+0 forum 1

I want to know if I would be able to replace different words all in one regex expression. For example if I wanted to replace the name John with Joe and Smith with Doe. Would I be able to do that with one expression? Here is a code that I have that changes the misspelled name correctly, however I need to replace two more different words with something else: Pattern replace = Pattern.compile("nam"); Matcher match = replace.matcher(words); words = match.replaceAll("name");

Member Avatar
Member Avatar
+0 forum 8

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
Member Avatar
+0 forum 8

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
Member Avatar
+0 forum 4

how do I do pattern matching for something like `/^(.*)text/` and `/text(.*)$/`?

Member Avatar
Member Avatar
+0 forum 1

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 by myself

Member Avatar
Member Avatar
+0 forum 8

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 (they are csv files) there are a large number of lines that are essentially empty entries (i.e. a bunch of empty commas). The result of my code is that it seems to hold onto the last correct strings (not the empty ones) and then tries to execute the sql statement. …

Member Avatar
Member Avatar
+0 forum 3

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 to ask me.

Member Avatar
Member Avatar
+0 forum 2

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 AB123AB 17-Feb-12 54321 Mgmt Chan Jackie 123-4321 ABC4321 ChanJ ChanJ@fake.mail.us 0 ABC-ABC 123ABCD123 ABCD 1234 A1234 ABC12345A1 AB123AB 17-Feb-12 From the first line I would be trying to extract "Aragon Denvil L." and from the second "Mgmt Chan Jackie". Worst case scenario I could maybe get away with just extracting …

Member Avatar
Member Avatar
+0 forum 2

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 lines lines lines exceptions] And so on... So Block 1 and 3 are same. And there are multiple cases like this. My ques is how can I read this file and write in an output file only the unique blocks? If there's a duplicate, it should be written only once. …

Member Avatar
Member Avatar
+0 forum 1

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
Member Avatar
+0 forum 2

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) import re with open('C:\\Users\\Desktop\\m\\test1.txt', 'r') as f_in: with open('C:\\Users\\Desktop\\m\\test_compare.txt', 'r') as f_compare: with open('C:\\Users\\Desktop\\m\\result.txt', 'w') as f_out: d1 = f_in.read() d2 = f_compare.read() for match in re.finditer(r'rhs="(.*)"', d1): if match not in d2: f_out.write('{}\n'.format(match.group(1))) while running the above code, it throws an error Traceback (most recent call last): File "C:\Python27\comparetwofiles\src\compare\notepadtest.py", …

Member Avatar
Member Avatar
+0 forum 2

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 all the extracts is: `var testRE; testRE = results.match("'(.*?)'");` (When I alert the length of testRE it only says 2). Any help is appreciated, thanks!

Member Avatar
Member Avatar
+0 forum 3

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 quoted text44[/quote] ... Resulting array should be: Array //PRESERVED ORDER ( [0] => Array ( ['type'] => unquoted ['name'] => '' ['text'] => some unquoted text11 ) [1] => Array ( ['type'] => quoted ['name'] => person1 ['text'] => some quoted text11 ) [2] => Array ( ['type'] => quoted …

Member Avatar
Member Avatar
+0 forum 7

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 search by regex e.g. return a list of all files that match *.json? The files are all included in the "src/main/resource" folder (I'm using Intellij 12) Any advice or pointers is much apreciated :)

Member Avatar
Member Avatar
+0 forum 1

Hello, im currently working on a program to split a string based on symbols only, i need to seperate the string around the symbols whilst keeping the symbols as well eg. test_String_123_^; would result in an array containing : [test] [_] [String] [_] [123] [_] [^] However although i have achieved it with this code : exampelstring.split("(?<=\\^)|(?=\\^)|(?<=\\_)|(?=\\_)"); I was wondering if there is a way to achieve this with less code as if i add more symbols then the regex becomes huge have a forward and behind check for each symbol. Is there a way to combine multiple lookaheads and …

Member Avatar
Member Avatar
+0 forum 4

How I can passing quantifier as variable in this regexp `str.match(/^(\-)?\d+( (\-)?\d+){3}$/)`

Member Avatar
Member Avatar
+0 forum 4

Hi all, i was trying to create a URL rewrite regex. The regex is something similar to this: \/pa\/*([0-9,a-z,A-Z,-]*) This regex works fine but i want to make this regex more dynamic so instead of "pa" i want that it matches any characters a user inputs. I create a regexr test so you may understand better what i mean, link is: [http://gskinner.com/RegExr/?368a2](http://gskinner.com/RegExr/?368a2)

Member Avatar
Member Avatar
+0 forum 2

The End.