Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 68/269 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • What can cause legit MySql INSERT INTO command to fail?

    - by Makis
    I can't figure out what's causing my INSERT INTO's to fail to certain table in MySql. I can manage them to other tables. The table looks like: CREATE TABLE IF NOT EXISTS `Match` ( `id` int(11) NOT NULL AUTO_INCREMENT, `match_no` int(11) NOT NULL, `season` int(11) NOT NULL, `hometeam` int(11) NOT NULL, `awayteam` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `match_no` (`match_no`), KEY `season` (`season`), KEY `hometeam` (`hometeam`), KEY `awayteam` (`awayteam`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; And the command is INSERT INTO Match (`match_no`, `season`, `hometeam`, `awaytem`) VALUES (1, 1, 2, 3) All I get is: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Match (match_no, season, hometeam, awaytem) VALUES (1, 1, 2, 3)' at line 1 I have checked the manual and half-a-dozen examples from the web and whatnought and tried all sorts of changes to the syntax in case there is some MySql specific oddity, but nothing seems to work.

    Read the article

  • XSL unique values per node

    - by Nathan
    ok i have this xml <roots> <root> <name>first</name> <item type='test'><something>A</something></item> <item type='test'><something>B</something></item> <item type='test'><something>C</something></item> <item type='test'><something>A</something></item> <item type='other'><something>A</something></item> <item type='test'><something>B</something></item> <item type='other'><something>D</something></item> </root> <root> <name>second</name> <item type='test'><something>E</something></item> <item type='test'><something>B</something></item> <item type='test'><something>F</something></item> <item type='test'><something>A</something></item> <item type='other'><something>A</something></item> <item type='test'><something>B</something></item> <item type='other'><something>D</something></item> </root> </roots> now i need to get the unique values of each root node so far i have <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" method="text"/> <xsl:key name="item-by-value" match="something" use="."/> <xsl:key name="rootkey" match="root" use="name"/> <xsl:template match="/"> <xsl:for-each select="key('rootkey','second')"> <xsl:for-each select="item/something"> <xsl:if test="generate-id() = generate-id(key('item-by-value', normalize-space(.)))"> <xsl:value-of select="."/> </xsl:if> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> if i use "First" as the key to get only the first root i get a good result ABCD how ever if i use "second" i only get EF but i need the result to be ABDFE

    Read the article

  • failed to load viewstate. the control tree into which viewstate

    - by Mohan
    Hi Everybody, i have a gridview control . When I change page of gridview control i get this error. Server Error in '/' Application. Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. how to tackle with this problem. It's urgent Any suggestion? Thanks in advance.

    Read the article

  • In need of a semantic thesaurus as a SAS

    - by Roy Peleg
    Hello, I'm currently building a web application. In one of it's key processes the application need to match short phrases to other similar ones available in the DB. The application needs to be able to match the phrase: Looking for a second hand car in good shape To other phrases which basically have the same meaning but use different wording, such as: 2nd hand car in great condition needed or searching for a used car in optimal quality The phrases are length limited (say 250 chars), user generated & unstructured. I'm in need of a service / company / some solution which can help / do these connections for me. Can anyone give any ideas? Thanks, Roy

    Read the article

  • Does .NET Regex support global matching?

    - by Dave
    I haven't been able to find anything online regarding this. There's RegexOptions, but it doesn't have Global as one of its options. The inline modifiers list also doesn't mention global matching. In a nutshell, I've got a regex to parse something like --arga= "arg1" --argb ="arg2" into separate argument name/value pairs using this regex: --(\\w+)\\s*=\\s*\"(\\w+)\"\\s* but the .NET Regex class doesn't do it globally (iteratively). So in order for me to get this to work, I'd have to do a match, then remove this from the argument string, and loop over and over again until I've exhausted all of the arguments. It would be nicer to run the regex once, and then loop over the match groups to get the name value pairs. Is this possible? What am I missing?

    Read the article

  • PHP Doctrine: Filter Table?

    - by ropstah
    I'm still not convinced after my previous question and some experience. Requirements: I don't want to use an SQL query everytime a filterBy() function is called and still be able to call -filterBy() on the returned table. Please find the comment @ ObjectsTable class: "How to instantiate another table and add records which match the filter criteria?" Usage: $globaltable = new ObjectsTable(); //globally accessible variable $globaltable->findAll(); //this call is made once at the beginning of the request $globaltable->filterBy('somefield', $someValue); //this function is used all over the place ObjectsTable class: class ObjectsTable extends Doctrine_Table { function filterBy($field, $value) { //How to instantiate another table and add records which match the criteria? } }

    Read the article

  • Python noob question - why is my simple regex not working?

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in phoneNumber = str(input("Please enter a phone number: ")) File "", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo btw. I did import re and tried using rstrip in case of the \n What else could I be missing? TIA, coson

    Read the article

  • Integer comparison as string

    - by J Pollack
    Hi I have an integer column and I want to find numbers that start with specific digits. For example they do match if I look for '123': 1234567 123456 1234 They do not match: 23456 112345 0123445 Is the only way to handle the task by converting the Integers into Strings before doing string comparison? Also I am using Postgre regexp_replace(text, pattern, replacement) on numbers which is very slow and inefficient way doing it. The case is that I have large amount of data to handle this way and I am looking for the most economical way doing this.

    Read the article

  • SQL constructs translated to OOP

    - by python dude
    As someone who comes from the world of Object Orientation, I find it rather difficult to wrap my head around SQL. Recently, however, I realized that the classical SQL construct select X from Y where Z is basically equivalent to the following OOP construct: List<SomeType> results = db.query(new Matcher<SomeType> () { public boolean match(SomeType candidate) { return ...; // checks condition Z on candidate, returns true for match } }; So my question is: What are the OOP equivalents for other SQL constructs, such as joins?

    Read the article

  • regex for shortforms

    - by Sourabh
    I need a regex (JavaScript) which will extract shortforms from a string for example from below string Hibbs' essays in progress include "Anselm's Sacramental Imagination," "W.E.B. DuBois and Socratic Questioning," and "Everything That Rises Must Converge: Aquinas's Theological Re-formation of the Cardinal Virtues." it will match "W.E.B." so the condition is it should have DOTs to seperate the letters or from Marcih J. Robert II. Distinguished Professor of Electrical & Computer Engineering. Ph.D. (1977) Texas Tech University, B.S./M.S. Rose-Hulman Institute of Technology (1972/1973). Ph.D. B.S. M.S. will match Thanks

    Read the article

  • RegEx - Indexed\Arrayed Named Capture groups?

    - by Josh
    I have a situation where something can appear in a format as follows: ---id-H-- Header: data Another Header: more data Message: sdasdasdasd Message: asdasdasdasd Message: asdasdasd There may be many messages, or just a couple. I'd prefer not having to step outside of RegEx, because I am using the RegEx to parse some header information above the messages and the messages along with the headers are part of the text I am parsing. The messages attached into the text might be many. I would also like to use named capture groups, so something like Message: (?<Message[index of match]>.+) Where it matches the match as many times as it can with the index filled in. Does anything like this exist in RegEx? (I will eventually be using this in Perl)

    Read the article

  • HTML Form Upload PDF with other form contents using PHP

    - by Sev
    I have a HTML form with fields such as name, address, notes, etc. I also have a field to upload a PDF. The uploaded PDF get's stored on the file system. How can I accomplish this if possibly the PDF files are larger than 2 MBs? Also, for some reason, the uploading of the PDF (< 2 MBs) works fine in Chrome, but not in IE. In IE, the upload doesn't even begin, but in Chrome, it completes fine. Form header looks like: method='post' ENCTYPE='multipart/formdata' edit: the ini setting didn't help The HTML <input type='text' name='user' /> <input type='file' name='userfile' /> The basic PHP ( I do some preg matching above, that I haven't included) $uploaddir = 'uploads/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File uploading failed.\n"; }

    Read the article

  • Regex: Matching a space-joined list of words, excluding last whitespace

    - by Jesper
    How would I match a space separated list of words followed by whitespace and some optional numbers? I have this: >>> import re >>> m = re.match('(?P<words>(\w+\s+)+)(?P<num>\d+)?\r\n', 'Foo Bar 12345\r\n') >>> m.groupdict() {'num': '12345', 'words': 'Foo Bar '} I'd like the words group to not include the last whitespace(s) but I can't figure this one out. I could do a .strip() on the result but that's not as much fun :) Some strings to test and wanted result: 'Foo & Bar 555\r\n' => {'num': '555', 'words': 'Foo & Bar'} 'Hello World\r\n' => {'num': None, 'words': 'Hello World'} 'Spam 99\r\n' => {'num': 99, 'words': 'Spam'} 'Number 1 666\r\n' => {'num': 666, 'words': 'Number 1'}

    Read the article

  • How come module-level validation errors only display when property-level validators are Valid?

    - by jonathanconway
    I'm using the module-level validator: 'PropertiesMustMatch' on my view-model, like so: [PropertiesMustMatch("Password", "PasswordConfirm")] public class HomeIndex { [Required] public string Name { get; set; } public string Password { get; set; } public string PasswordConfirm { get; set; } } I'm noticing that if I submit the form without Name filled in, the ValidationSummary() helper returns only the following error: The Name field is required. However, if I fill in Name, then ValidationSummary() will return a PropertiesMustMatch error: 'Password' and 'PasswordConfirm' do not match. So it looks like the property-level validators are being evaluated first, then the model-level validators. I would much prefer if they were all validated at once, and ValidationSummary would return: The Name field is required. 'Password' and 'PasswordConfirm' do not match. Any ideas what I can do to fix this? I'm studying the MVC 2 source-code to try to determine why this happens.

    Read the article

  • Limit VS2010 Intellisense Camel Case matching

    - by Gabriël
    Hi, I just started with VS2010 and the feature I was really looking forward too was the new Intellisense, and the Camel casing matching in particular. But I must say I'm pretty dissapointed with the way it works and am wondering if this is just a setting, or not. When I type 'OIE' I get the following results: OrderItemBackerEntity (OIBE) OrderGarmentActionGroupItemEntity (OGAGIE) OrderItemClothingEntity (OICE) OrderItemEntity (OIE) << GOOD These indeed do match in some way, but why does it match so broad, and not only the fitting one, the last one. Are these settings, or is this by design?

    Read the article

  • Binding dropdown list in a gridview edit item template

    - by Renju
    i can bind the dropdownlist in the edit item template. The drop down list is having null values. protected void grdDevelopment_RowDataBound(object sender, GridViewRowEventArgs e) { DropDownList drpBuildServers = new DropDownList(); if (grdDevelopment.EditIndex == e.Row.RowIndex) { drpBuildServers = (DropDownList)e.Row.Cells[0].FindControl("ddlBuildServers"); } } also getting an error Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

    Read the article

  • Parsing Indentation-based syntaxes in Haskell's Parsec

    - by pavpanchekha
    I'm trying to parse an indentation-based language (think Python, Haskell itself, Boo, YAML) in Haskell using Parsec. I've seen the IndentParser library, and it looks like it's the perfect match, but what I can't figure out is how to make my TokenParser into an indentation parser. Here's the code I have so far: import qualified Text.ParserCombinators.Parsec.Token as T import qualified Text.ParserCombinators.Parsec.IndentParser.Token as IT lexer = T.makeTokenParser mylangDef ident = IT.identifier lexer This throws the error: parser2.hs:29:28: Couldn't match expected type `IT.TokenParser st' against inferred type `T.GenTokenParser s u m' In the first argument of `IT.identifier', namely `lexer' In the expression: IT.identifier lexer In the definition of `ident': ident = IT.identifier lexer What am I doing wrong? How should I create an IT.TokenParser? Or is IndentParser broken and to be avoided?

    Read the article

  • Regular Expressions, Checking for a range of occurrences

    - by gmcalab
    I have a phone number I want to match against a regular expression. The format of the phone number must match this: (123) 123-4567 x12345 The extension is optional. Also the extension must contain 1-5 numbers. Below is a regular expression I wrote that works. ^\(\d{3}\) \d{3}-\d{4}( x\d\d?\d?\d?\d?)?$ I was wondering if there is a better way to check for the extension instead of x\d\d?\d?\d?\d? Can I say 1-5 occurrences of \d instead of the above some how ?

    Read the article

  • Define a regex, which matches one digit twice and all others once

    - by Amin
    As part of a larger regex I would like to match the following restrictions: The string has 11 digits All digits are numbers Within the first 10 digits one number [0-9] (and one only!) must be listed twice This means the following should match: 12345678914 12235879600 Whereas these should not: 12345678903 -> none of the numbers at digits 1 to 10 appears twice 14427823482 -> one number appears more than twice 72349121762 -> two numbers appear twice I have tried to use a lookahead, but all I'm managing is that the regex counts a certain digit, i.e.: (?!.*0\1{2}) That does not do what I need. Is my query even possible with regex?

    Read the article

  • Does Parallel.ForEach require AsParallel()

    - by dkackman
    ParallelEnumerable has a static member AsParallel. If I have an IEnumerable<T> and want to use Parallel.ForEach does that imply that I should always be using AsParallel? e.g. Are both of these correct (everything else being equal)? without AsParallel: List<string> list = new List<string>(); Parallel.ForEach<string>(GetFileList().Where(file => reader.Match(file)), f => list.Add(f)); or with AsParallel? List<string> list = new List<string>(); Parallel.ForEach<string>(GetFileList().Where(file => reader.Match(file)).AsParallel(), f => list.Add(f));

    Read the article

  • Objective C - RegexKitLite - Parsing inner contents of a string, ie: start(.*?)end

    - by Stu
    Please consider the following: NSString *myText = @"mary had a little lamb"; NSString *regexString = @"mary(.*?)little"; for)NSString *match in [myText captureComponentsMatchedByRegex:regexString]){ NSLog(@"%@",match); } This will output to the console two things: 1) "mary had a little" 2) "had a" What I want is just the 2nd bit of information "had a". Is there is a way of matching a string and returning just the inner part? I'm fairly new to Objective C, this feels a rather trivial question yet I can't find a less messy way of doing this than incrementing an integer in the for loop and on the second iteration storing the "had a" in an NSString.

    Read the article

  • [C#, Regex] EOL Special Char not matching

    - by Aurélien Ribon
    Hello, I am trying to find every "a - b, c, d" pattern in an input string. The pattern I am using is the following : "^[ \t]*(\\w+)[ \t]*->[ \t]*(\\w+)(,[ \t]*\\w+)*$" The input is : a -> b b -> c c -> d The function is : private void ParseAndBuildGraph(String input) { MatchCollection mc = Regex.Matches(input, "^[ \t]*(\\w+)[ \t]*->[ \t]*(\\w+)(,[ \t]*\\w+)*$", RegexOptions.Multiline); foreach (Match m in mc) { Debug.WriteLine(m.Value); } } The output is : c -> d Actually, there is a problem with the line ending "$" special char. If I insert a "\r" before "$", it works, but I thought "$" would match any line termination (with the Multiline option), especially a \r\n in a Windows environment. Is it not the case ?

    Read the article

  • Regular Expression Help in .NET

    - by Matt H.
    I have a simple pattern I am trying to match, any characters captured between parenthesis at the end of an HTML paragraph. I am running into trouble any time there is additional parentheticals in that paragraph: i.e. If the input string is "..... (321)</p" i want to get the value (321) However, if the paragraph has this text: "... (123) (321)</p" my regex is returning "(123) (321)" (everything between the opening "(" and closing ")" I am using the regex pattern "\s(.+)</p" How can I grab the correct value (using VB.NET) This is what I'm doing so far: Dim reg As New Regex("\s\(.+\)</P>", RegexOptions.IgnoreCase) Dim matchC As MatchCollection = reg.Matches(su.Question) If matchC.Count > 0 Then Dim lastMatch As Match = matchC(matchC.Count - 1) Dim DesiredValue As String = lastMatch.Value End If

    Read the article

  • CSharp -- PInvokeStackImbalance detected on a well documented function?

    - by Aaron Hammond
    Here is my code for a ClickMouse() function: [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo); private const long MOUSEEVENTF_LEFTDOWN = 0x02; private const long MOUSEEVENTF_LEFTUP = 0x04; private const long MOUSEEVENTF_RIGHTDOWN = 0x08; private const long MOUSEEVENTF_RIGHTUP = 0x10; private void ClickMouse() { long X = Cursor.Position.X; long Y = Cursor.Position.Y; mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0); } For some reason, when my program comes to this code, it throws this error message: PInvokeStackImbalance was detected Message: A call to PInvoke function 'WindowsFormsApplication1!WindowsFormsApplication1.Form1::mouse_event' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature. Please help?

    Read the article

  • bash: how to know NUM option in grep -A -B "on the fly" ?

    - by Michael Mao
    Hello everyone: I am trying to analyze my agent results from a collection of 20 txt files here. If you wonder about the background info, please go see my page, what I am doing here is just one step. Basically I would like to take only my agent's result out of the messy context, so I've got this command for a single file: cat run15.txt | grep -A 50 -E '^Agent Name: agent10479475' | grep -B 50 '^==' This means : after the regex match, continue forward by 50 lines, stop, then match a line separator starts with "==", go back by 50 lines, if possible (This would certainly clash the very first line). This approach depends on the fact that the hard-coded line number counter 50, would be just fine to get exactly one line separator. And this would not work if I do the following code: cat run*.txt | grep -A 50 -E '^Agent Name: agent10479475' | grep -B 50 '^==' The output would be a mess... My question is: how to make sure grep knows exactly when to stop going forward, and when to stop getting backward? Any suggestion or hint is much appreciated.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >