1,034 Topics
![]() | |
hi, I have a textbox where i dont want numbers to be typed.I have a code for it but when the user types only letters and goes to a new line and saves it wont allow to save.How can i fix this? Match matchFullNameRegex = Regex.Match(fullNameTextBox.Text, "^[a-zA-Z ]*$"); if (!matchFullNameRegex.Success) … | |
Hi, im working with the Java Regex class and so im parsing some text. each piece of text is in a separate line. here's a sample of the text: this is textHello world buzzinga! Makmende says hi Makmende has poked u. dnt try poking him back! young, forever young another … | |
I am planning to use preg_replace to remove some unwanted stuff from dynamic string $mystring: <ul><li><a href="http://www.url.com/wiki/How_to_fix_erection_problems_after_prostate_surgery&diff=335&oldid=prev">How to fix erection problems after prostate surgery</a></li> <li><a href="http://www.url.com/wiki/Wikipenis:Community_Portal&diff=334&oldid=prev">Wikipenis:Community Portal</a></li> </ul> This string is generated from an RSS reader. (The url has obviously been replaced to make sure no one thinks this is … | |
Hello. I just want to know if it's possible to use regular expressions in the match attribute of the template element. For example , suppose i have the follow xml document: <greeting> <aaa>Hello</aaa> <bbb>Good</bbb> <ccc>Excellent</ccc> <dddline>Line</dddline> </greeting> Now the xslt to transform the above document: <xsl:stylesheet> <xsl:template match="/"> <xsl:apply-templates select="*"/> … | |
Ayoo errbody, So i have an array full of strings that I need to apply some regular expressions to and then store the results in another array. What would be the best way to do this? | |
Hello, I have a code that adds proxies to a richtext box, and I would like to make it add each proxy to the list box, Ive tried many things. Can anyone help? [code]private void Button1_Click(object sender, EventArgs e) { string innerHtml; IEnumerator enumerator; try { if (this.WebBrowser1.Url != new … | |
I found this great piece of code for validating URL's. I've been trying to get it to work with preg_match() since eregi() is deprecated with with PHP 5.3: [code=php]// SCHEME $urlregex = "^(https?|ftp)://"; // USER AND PASS (optional) $urlregex .= "([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?"; // HOSTNAME OR IP $urlregex .= "[a-z0-9+$_-]+(.[a-z0-9+$_-]+)*"; // http://x … | |
Hi, Im trying to match patterns to get A-F and number range 0-9 So like 9D 4EEE Not 15d heres the code i have got so far [CODE] import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class sam { public static void main (String [] args){ //instantiate scanner Scanner s = … | |
HI to all, I am in need of escaping the regular expression special characters like '/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\'. I have try with this by the following javascript but i can not achieve that. [code]RegExp.escape=function(str) { if (!arguments.callee.sRE) { var specials = … | |
For this project i need to have the ability to analyze a file containing a number of .NET(3.5) class's from source code.. identify every class and then output each seperate class into their own text file i.e(this is what the file is like, contains a number of class's in it, … | |
[CODE]Warning: preg_match_all() [function.preg-match-all]: Compilation failed: range out of order in character class at offset 76 in C:\xampp\htdocs\extracter.php on line 7[/CODE] hey i am not able to figure out what kind of warning is this? the line 7 is this in the code [CODE]preg_match_all("/(http:\/\/)?(www.)?rapidshare\.com\/[0-9A-Za-z]+\/[0-9A-Za-z]+\/[0-9A-Za-z_-.]+/",$contents1,$out1);[/CODE] | |
Hi guys... guess i won't be posting after this for a long time.... could you all please help me out with syntax highlighting in c++ once again. I have made a full featured text editor(please check the snippet C.L.O.S.E) but could you please suggest about syntax highlighting or atleast indentation.. … | |
![]() | I'm trying to import a module that checks an .ini config file for correct syntax (via regex patterns). If the syntax is wrong, I want the main code to crash (and hopefully log the error, too). I need some guidance on how I should do this. My current approach doesn't … |
This is my regex originally from VB. [code]using System.Text.RegularExpressions;[/code] [code] #region "Regex" public object preg_match(System.Object sRegex, System.Object sHaystack) { // Declare some varis MatchCollection Matches = default(MatchCollection); // My Regex to match some text. It is actually a whole <div> block. Regex TheRegex = new Regex("sRegex"); // Get the Source … | |
Hello everyone, i'm trying to use 2 mootools scripts together in one source. They work serperately but as soon as i combine them only one is working. It seems they interfere with each other but i can't seem to find the problem. Can anyone help me out? I'll paste them … | |
Hi, I have a line of text here: Directions: Take the #8 from Meadow Park(31), and get off at Kroger East (57). I am trying to get it to match both (31) and (57), which some other context may have different numbers, but there could be either 1 or 2 … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; import java.text.*; import java.util.regex.*; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; class Clustering1 { public static void main(String[] args) throws IOException, FileNotFoundException { int diff_matrix[][] = new int[500][500]; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the data file name\n"); String fname=br.readLine(); … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; import java.text.*; import java.util.regex.*; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; class Clustering1 { public static void main(String[] args) throws IOException, FileNotFoundException { int diff_matrix[][] = new int[500][500]; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the data file name\n"); String fname=br.readLine(); … | |
Im trying to write c# form validation for a xaml-form. The only two things that seem to work are the lines of code that clears the text- and passwordboxes and displays the messagebox. Are my regex-examples wrong, or do I need to work with some kind of while-statement(s)? [code=c] //start … | |
I have some random text like: [CODE]>>>text= \ """import sys n = int(sys.argv[1]) ;;print "blbalbalbalabllalbaa" replace me i in range(1,n) {print "numbers:";;replace me j in range(1,3) {print j} ;;print i ;;replace me k in range(1,3) {print k} ;;print "end!"} replace me n < 5 {print n ;;print "youragenious"} """[/CODE] i'd … | |
Okay, so I'm having problems with my code. I've browsed Daniweb and couldn't find any solutions on here that work. I'm extracting 2 sets of texts from a .xml file. The first part is a directory name(eg. "C:\work\") and the second part is the name of a file in that … | |
I've been trying to match some incoming strings from a mud(text based rpg) and I'm having some trouble. I need a regex that will match the <mob> tag in these strings. You can have a separate regex per sentence to match the surrounding text. You would stomp <mob> into the … | |
![]() | Given a coordinate string -- 'x, y' -- where x and y are 1-4 digits, separated by \D+: '34, 58' I want to able to get a tuple with each number as an integer: (34 , 58) [B]Method 1[/B]: I could find the numbers, convert the tuple groups() to a … |
i have been asked to make phone book console application in java using collections/data structure i have done some of it. i am having problem that i have to store firstname,lastname,cellnumber,emailaddress etc in such a way into collection so that if some one wants to search phone number from phonebook … | |
Hi, I have a code which uses HTMLParser to reach a webpage where an exe file is located. The code then downloads and installs the file on local machine. I need a solution for the below problem: HTMLParser reaches a webpage where there are links to clients_test2, clients_test5, clients_test8. Each … | |
Hello again, I am trying to replace a string which is actually different from line to line in a text file. I want to end up with a filename but without the path. For example: My text file contains: C:\test\testingmore\filename.mpg C:\test\testfiles1\testfile4.mpg W:\testinglocation\testingmore\testfiles9.mpg I would like to replace the path in … | |
hi!!i'm new in java programming and i have a project in which i use regex and xml input and output!my project is about gathering information about weather predictions in weather forecasts for some cities!my problem is that i'm new in java programming and i have problem making this project to … | |
![]() | I don't know if this is helpful for moderators but I've put together a code formatter in dotnet which automatically beautifies someone's code. Numerous times you will see newbies posting without code tags. Now the moderators can easily quote the post so the indentation is preserved, but sometimes the posters … ![]() |
I'm trying to write a script that will go to a host and list all of its shares. So far, in my searching, it seems that I need to include a top level share name. For example: [CODE]os.listdir('\\\\1.2.3.4\')[/CODE] doesn't seem to work, but [CODE]os.listdir('\\\\1.2.3.4\\share\')[/CODE] will work. As a bit of … | |
hey all. I am trying to do validation via PHP for submitted forms. Below is my own code, please comment if its the correct method or not. However, I tried so many ways to have the /n or /r added, but I cant get to it. Its just to make … | |
Hei i tried to fill DataGridView from MatchCollection anyone knows how to do this? thanks... [CODE] Regex objNotNaturalPattern = new Regex(@txtRegex.Text, RegexOptions.IgnoreCase); MatchCollection matches = objNotNaturalPattern.Matches(pagesource); int h = 0; lbResult.Text += "\n"; while (h < matches.Count) { Match m = matches[h]; for (int ctr = 1; ctr < m.Groups.Count; … | |
![]() | Hi all, I'm trying to get the content of a div with php. I can't find a way to use javascript in php to do it so I was thinking that regex would be the way? If it helps the div id is "editor". Thanks in advance, if you need … ![]() |
hi all, i've a file named "a.config" with the line "CLUSTER_NAME[\t][\t]cluster1" by [\t] i mean tabs. now i need to change the value cluster1 to someother value, say autocluster. The code which i wrote was : [CODE]cat a.config | sed 's/CLUSTER_NAME[\t][\t] [A-Za-z0-9]*/CLUSTER_NAME[\t][\t]autocluster/' > a.config.temp[/CODE] [CODE]mv a.config.temp a.config[/CODE] but this doesn … | |
Hi! This code should replace <br> or <br /> between certain elements in text posted in textarea element. I use [B]nl2br[/B] for detection of new line. That function also adds <br /> between html elements...for example <table>[COLOR="Red"]<br>[/COLOR]<tr> elements... Code works fine, but... When used multiple column table, code "eats" all … | |
Hi guys, I am a complete newbie (but learning slowly). I am trying to make a script to check for proxies that are contained in a file using a regex. Fact is that I lack of knowledge and I do not know how to make it go. This is my … | |
Hi, I have a text file that contains bunch of phone numbers. Some contain invalid characters and some are too long. How do i read this file into a list using regex. I only want valid phone numbers to populate the list, and skip the invalid ones. this is what … | |
I have tried to wrap my head around regex and have failed pretty miserably. Here is my problem. how would you do the following with regular expressions in php. replace [CODE]<use xlink:href='#gpPt4' transform='translate([B][U]261.7,184.3[/U][/B]) scale([B][U]4.50[/U][/B])'/>[/CODE] with [CODE]<use xlink:href='#gpPt4' transform='translate([B][U]261.7,184.3[/U][/B]) scale([B][U]4.50[/U][/B])' onclick="alert('a variable name from php')"/>[/CODE] where the bolded/underlined sections (only used … | |
Hi everybody, I'm trying to make a program that goes through a directory and checks for broken links. Unfortunately it isn't working: [CODE] // Main.cs using System; using System.Collections.Generic; using Gtk; namespace LinkMonkey { class MainClass { public static void Main (string[] args) { bool cli = true; bool recursive … | |
Hi all. I'm a newbie here so excuse my question if it's a bit dumb. I'm a C programmer but needed to do some text file stripping so was told Pythin would be good for this. I have been messing about with this for about a week now and have … | |
Hello, I need a pattern for the following use cases: I am using Java 1. [B]var so = nokia.device.load('abc','abc');[/B] 2. [B]var so = nokia.device.load("abc","abc");[/B] 3. [B]var so = nokia.device.load("abc");[/B] 4. [B]var so = nokia.device.load('abc');[/B] // 5. [B][I]var so = nokia.device.load('abc'); (Line is commentted)[/I][/B] /* function init() { if (window.menu) { … | |
I know I can accomplish this with Regex, however, being not familiar with RegEX (yet to find a good howto/reference), I was wondering if there's other simple ways to parce XML files, or if there's a tutorial for regex somewhere For example, I want to get the Hello World! from … | |
Howdy! I'm trying to get my head around some simple pattern matching or regular expressions using python. Basically I want to be able to match "Failed 0.00/100.00", where 0.00 could be any decimal number. I know using perl it would be something along the lines of "\d+\.\d+\/100\.0", but could anybody … | |
[CODE] private Map<String , String> c = new HashMap<String , String>(); .... //regx to get mString c.put(mString.group() , mString.group()); ..... //regx to get mNumber c.put(mNumber.group() , mNumber.group()); ....... Set set = c.entrySet(); Iterator i = set.iterator(); while( i.hasNext() ) { Map.Entry me = (Map.Entry) i.next(); System.out.println(me.getKey() + " : " … | |
Hi. I am trying to match a string: "RemoveAcc $k: $v" There are an arbitrary number of spaces between RemoveAcc and the two variables...Preferably I would like to store these to variables using $1 and $2 after the string is parsed, but I do not want to save the RemoveAcc … | |
Hello! =) Please help me with this! =) This is my last one to my diploma work! =) If the user enters a number in the textfield, than JS should set the selection in the textarea to that line. Empty lines are changed to " \n" coz I like for-in … | |
Can someone please help me - I need to write a function that will validate UK postcodes written in a textbox but every tutorial and example source code I find for it is in other languages such as VB and Javascript. The VB code looks extremely small: 1. Public Function … | |
Hi Guys, I'm in need of regular expression for validating the html tags that are closed properly, say for example <i>test content <b>see this </i> .. it should show an alert "tag is incorrect". Plz help me....Guys-:)-:) Thanks in advance | |
I'm reading in a text file and want to parse based on labels within the text file. At first I was trying to do this with patterns, but after spending some time reading the API documents, I'm not sure what I need. I think I'm making this too complicated. Example … | |
Hey guys, Once again i need help and this time i have no idea how to do it. I would love it if someone could help me out here =) . Basically what i want to do is open a txt file using openfiledialog which i have set out and … | |
Hi, could you tell me where I can find some information about regex engine optimizations used by Python regex engine? |
The End.