Search Results

Search found 3804 results on 153 pages for 'regex'.

Page 31/153 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • how to prevent white spaces in a regular expression regex validation

    - by Rees
    i am completely new to regular expressions and am trying to create a regular expression in flex for a validation. using a regular expression, i am going to validate that the user input does NOT contain any white-space and consists of only characters and digits... starting with digit. so far i have: expression="[A-Za-z][A-Za-z0-9]*" this correctly checks for user input to start with a character followed by a possible digit, but this does not check if there is white space...(in my tests if user input has a space this input will pass through validation - this is not desired) can someone tell me how i can modify this expression to ensure that user input with whitespace is flagged as invalid?

    Read the article

  • Java String.replaceAll regex

    - by atomsfat
    I want to replace the first context of web/style/clients.html with the java String.replaceFirst method so I can get: ${pageContext.request.contextPath}/style/clients.html I tried String test = "web/style/clients.html".replaceFirst("^.*?/", "hello/"); And this give me: hello/style/clients.html but when I do String test = "web/style/clients.html".replaceFirst("^.*?/", "${pageContext.request.contextPath}/"); gives me java.lang.IllegalArgumentException: Illegal group reference

    Read the article

  • jQuery: select all inputs with unique id (Regex/Wildcard Selectors)

    - by d3020
    I have some textboxes on a webform that have ids like this: txtFinalDeadline_1 txtFinalDeadline_2 txtFinalDeadline_3 txtFinalDeadline_4 In my jQuery how do I find all of those in order to assign a value to them. Before I had the underscore and they were all named txtFinalDeadline I could do this and it worked. $(this).find("#txtFinalDeadline").val(formatDate); However, that was when they were all named the same thing. Now I have the _x after the name and I'm not sure how to go about assigning that same value as before to them. Thanks.

    Read the article

  • initial caps in actionScript using Regex

    - by Deyon
    I'm trying to do initial caps in actionScript with no loops but now i'm stuck. I wanted to select the first letter or every word then apply uppercase on that letter. Well I got the selection part right, but at a dead end right now, any ideas? I was trying to do this with out loops and cutting up strings. //replaces with x cant figure out how to replace with the found result as uppercase public function initialcaps():void { var pattern:RegExp=/\b[a-z]/g; var myString:String="yes that is my dog dancing on the stage"; var nuString:String=myString.replace(pattern,"x"); trace(nuString); }

    Read the article

  • String format or REGEX.

    - by ThePower
    I need an simple way to check whether a string that is sent to my function is of the form: (x + n)(x + m) //the +'s can be minus' //n and m represent a double //x represents the char 'x' Is there a simple string format that I can use to check that this is the form. As opposed to checking each character singularly. The whitespace will be removed to save any confusion. Regards Lloyd

    Read the article

  • Need to add underscore to my regex

    - by TaMeR
    I suck at regular expression and just can't seem to figure this out. '/^[A-Za-z0-9](?:.[A-Za-z0-9]+)*$/' As it's right now it allows dots anytime after the first char and I like to add _ so that it allows both. Thanks

    Read the article

  • Need Flex Regex Validation Expression for password that allows for only alphanumeric values and requ

    - by BlueDude
    Hi I'm trying to setup a RegexpValidator that only accepts a string of alphanumeric characters between 6-30 characters long and requires one number. I'm new to Regular Expressions and everything I've tried seems to keep returning an invalid ValidationRsultEvent. Here's a chunk of code: <mx:RegExpValidator id="regexValidator" source="{passwordInput}" property="text" triggerEvent="" valid="onPasswordValidate(event)" invalid="onPasswordValidate(event)" /> private function validateRegister():void { regexValidator.expression = "^(?=.*(\d|\W)).{6,30}$"; regexValidator.validate(); }

    Read the article

  • Ruby RegEx not matching valid expression

    - by Matthew Carriere
    I have the following expression: ^\w(\s(+|-|\/|*)\s\w)*$ This simply looks to match a mathematical expression, where a user is prompted for terms separated by basic operators (ex: price + tax) The user may enter more than just 2 terms and one operator (ex: price + tax + moretax) I tested this expression in Rubular http://rubular.com/ With the terms: a + a (MATCH) a + a + a (MATCH) a + a + a + a a a + a a Everything works, but when I use it in Ruby it does not work! expression =~ /^\w(\s(+|-|\/|*)\s\w)*$/ I started picking the expression apart and noticed that if I remove the start of line caret it finds matches but isn't correct. a + a (MATCH) a a (MATCH) <-- this is not correct Why is this expression not working in Ruby code? (I am using Ruby 1.8.7 p174)

    Read the article

  • What is proper RegEx expession for SWIFT codes?

    - by abatishchev
    I have to filter user input to on my web ASP.NET page: <asp:TextBox runat="server" ID="recipientBankIDTextBox" MaxLength="11" /> <asp:RegularExpressionValidator runat="server" ValidationExpression="?" ControlToValidate="recipientBankIDTextBox" ErrorMessage="*" /> As far is I know SWIFT code must contain 5 or 6 letters and other symbols up to total length 11 are alphanumeric. How to implement such rule properly? TIO

    Read the article

  • bash: assign grep regex results to array

    - by Ryan
    Hello everyone, I am trying to assign a regular expression result to an array inside of a bash script but I am unsure whether that's possible, or if I'm doing it entirely wrong. The below is what I want to happen, however I know my syntax is incorrect: indexes[4]=$(echo b5f1e7bfc2439c621353d1ce0629fb8b | grep -o '[a-f0-9]\{8\}') such that: index[1]=b5f1e7bf index[2]=c2439c62 index[3]=1353d1ce index[4]=0629fb8b Any links, or advice, would be wonderful :)

    Read the article

  • StackOverflowError occured as using java.util.regex.Matcher

    - by Captain Kidd
    Hi guys I try to catch text by Regular Expression. I list codes as follows. Pattern p=Pattern.compile("<@a>(?:.|\\s)+?</@a>"); Matcher m = p.matcher(fileContents.toString()); while(m.find()) { //Error will be thrown at this point System.out.println(m.group()); } If the length of text I want to catch is too long, system will throw me a StackOverflowError. Otherwise, the codes work well. Please help me how to solve this problem.

    Read the article

  • What is proper RegEx expression for SWIFT codes?

    - by abatishchev
    I have to filter user input to on my web ASP.NET page: <asp:TextBox runat="server" ID="recipientBankIDTextBox" MaxLength="11" /> <asp:RegularExpressionValidator runat="server" ValidationExpression="?" ControlToValidate="recipientBankIDTextBox" ErrorMessage="*" /> As far is I know SWIFT code must contain 5 or 6 letters and other symbols up to total length 11 are alphanumeric. How to implement such rule properly? TIO

    Read the article

  • Regex - Modifying strings except in specified enclosures - PHP

    - by Kovo
    I have found similar answers to my current needs on SO, however I am still trying to grasp modifying strings based on a rule, except in certain enclosures within those strings. Example of what Im trying to accomplish now: preg_replace("/\s*,\s*/", ",", $text) I found the above in many places. It will remove spaces before and after all commas in a string. That works great. However, if I want to exclude modifying commas found within " ", I am not sure how that rule has to be modified. Any help? Thanks! EDIT: I want to clarify my question: I would like all whitespace before and after the commas in the following sentence removed, except commas found in double or single quotes: a, b , c "d, e f g , " , h i j ,k lm,nop Expected result: a,b,c "d, e f g , ",h i j,k lm,nop

    Read the article

  • Java Regex for matching quoted string with escaped quotes

    - by kayahr
    I know there are already many questions like mine but I found no answer which works in Java. So I write a new question. I have text files with content like this: key1 = "This is a \"test\" text with escapes using '\\' characters"; key2 = 'It must work with \'single\' quotes and "double" quotes'; I need a regular expression which matches the values in the double-quotes (or single-quotes). This regular expression must support the escaped quotes and escaped backslashes. The regular expression must work with Java standard Pattern/Matcher classes.

    Read the article

  • cant get regex to work as i want

    - by Jorm
    With this function: function bbcode_parse($str) { $str = htmlentities($str); $find = array( '/\\*\*(.[^*]*)\*\*/is', ); $replace = array( '<b>' ); $str = preg_replace($find, $replace, $str); return $str; } And with text "My name is **bob**" I get in source code Hi my name is <b> Been trying to get this to work for a while now. Would appricate some expert help :)

    Read the article

  • Regex to use each letter only once?

    - by gtcaz
    Is it possible to construct a PCRE-style regular expression that will only match each letter in a list only once? For example, if you have the letters "lrsa" and you try matching a word list against: ^[lrsa]*m[lrsa]*$ you're going to match "lams" (valid), but also "lamas" (invalid for our purposes because you only had one "a"). If your letter set was "lrsaa", you would want to match "lamas". Is this possible with regular expressions, or should I handle it programmatically?

    Read the article

  • php regex filename

    - by Patrick
    Hi, anyone can help me with a preg_match? I'd like to use php's preg_match to determine if an input is a valid filename or not (only the filename + file extension, not the full path). General rules: 1) filename = a-z, A-Z, 0-9 2) extension = 3 or 4 letters Thank you!

    Read the article

  • understanding this regex

    - by DarthVader
    I m trying to understand what the following does. ^([^=]+)(?:(?:\\=)(.+))?$ Any ideas? This is being used here. Obviously it s command line parser but i m trying to understand the syntax so i can actually run the program. This is from commandline-jmxclient , they have no documents on setting JMX properties but in their source code, there is such an option, so i just want to understand how i can invoke that method. Matcher m = Client.CMD_LINE_ARGS_PATTERN.matcher(command); if ((m == null) || (!m.matches())) { throw new ParseException("Failed parse of " + command, 0); } this.cmd = m.group(1); if ((m.group(2) != null) && (m.group(2).length() > 0)) this.args = m.group(2).split(","); else this.args = null;

    Read the article

  • jQuery Validate plugin - password check - minimum requirements - Regex

    - by QviXx
    I've got a little problem with my password-checker. There's got a registration form with some fields. I use jQuery Validate plugin to validate user-inputs. It all works except the password-validation: The password should meet some minimum requirements: minimum length: 8 - I just use 'minlength: 8' at least one lower-case character at least one digit Allowed Characters: A-Z a-z 0-9 @ * _ - . ! At the moment I use this code to validate the password: $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); This Code works for the allowed characters but not for minimum requirements. I know that you can use for example (?=.*[a-z]) for a lower-case-requirement. But I just don't get it to work. If I add (?=.*[a-z]) the whole code doesn't work anymore. I need to know how to properly add the code to the existing one. Thank you for your answers! This is the complete code <script> $(function() { $("#regform").validate({ rules: { forename: { required: true }, surname: { required: true }, username: { required: true }, password: { required: true, pwcheck: true, minlength: 8 }, password2: { required: true, equalTo: "#password" }, mail1: { required: true, email: true }, mail2: { required: true, equalTo: "#mail1" } }, messages: { forename: { required: "Vornamen angeben" }, surname: { required: "Nachnamen angeben" }, username: { required: "Usernamen angeben" }, password: { required: "Passwort angeben", pwcheck: "Das Passwort entspricht nicht den Kriterien!", minlength: "Das Passwort entspricht nicht den Kriterien!" }, password2: { required: "Passwort wiederholen", equalTo: "Die Passwörter stimmen nicht überein" }, mail1: { required: "Mail-Adresse angeben", email: "ungültiges Mail-Format" }, mail2: { required: "Mail-Adresse wiederholen", equalTo: "Die Mail-Adressen stimmen nicht überein" } } }); $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); }); </script>

    Read the article

  • Regex optional match in python fails

    - by AaronG
    tickettypepat = (r'MIS Notes:.**(//p//)?.**') retype = re.search(tickettypepat,line) if retype: print retype.group(0) print retype.group(1) Given the input. MIS Notes: //p// Can anyone tell me why group(0) is MIS Notes: //p// and group(1) is returning as None?

    Read the article

  • Javascript how many characters replaced in a regex?

    - by macca1
    I am sanitizing an input field and manually getting and setting the caret position in the process. With some abstraction, here's the basic idea: <input type="text" onkeyup"check(this)"> And javascript... function check(element) { var charPosition = getCaretPosition(element); $(element).val( sanitize( $(element).val() ) ); setCaretPosition(element, charPosition); } function sanitize(s) { return s.replace(/[^a-zA-Z0-9\s]/g, ''); } This is working fine except when a character does actually get sanitized, my caret position is off by one. Basically I'd like a way to see if the sanitize function has actually replaced a character (and at what index) so then I can adjust the charPosition if necessary. Any ideas?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >