Java reg expressions

Does anyone know of a regular expression that will parse all of the text not inside tags of an html document and write it out? Even if the html is badly coded with tags that open and do not close on the same line. I am trying to use backreferencing. Here is my code:
import java.io.*;
import java.util.*;
import java.util.regex.*;
public class parseHTML {
public static void main(String[] args)
try
BufferedReader in = new BufferedReader(new FileReader("In.txt"));
PrintWriter out = new PrintWriter(new FileWriter("Out.txt"));
String aLine = null;
String pattern1 = "<.+>|.*>|<.*(.*)";
Pattern p1 = Pattern.compile(pattern1);
while((aLine = in.readLine()) != null)
Matcher m1 = p1.matcher(aLine);
if(m1.find())
StringBuffer sb = new StringBuffer();
m1.appendReplacement(sb, "$1" + "\n");
System.out.print(sb.toString());
out.print(sb.toString());
m1.reset(aLine);
in.close();
out.close();
catch(IOException exception)
exception.printStackTrace();
}

Does anyone know of a regular expression that will
parse all of the text not inside tags of an html
document and write it out?
No. However, I am rather certain that it is notpossible.
ANYTHING is possible with regular expressions, its
just doing it again on different data. Then it gets
complicated.Nope. It is not possible write only a regular expression which will parse a "balanced" expression which goes to any depth. You can write one which goes to a fixed depth but not an arbritrary one. "Balanced" would be defined for example by opening and closing parenthesis. Or html tags.
See "Mastering Regular Expressions" by Jeffery E.F. Fridel, Chap 4, the section on Difficulties and Impossibilities.
Naturally you can write a program, which might even use regular expressions, to do that. But that is not the same.

Similar Messages

  • Java Regular Expressions

    Hi all
    Just learning about Java Reg Exp's but falling at the first herdle!! Please view the following test code:
    import java.util.regex.*;
    import java.lang.*;
    public class RegTest
       public static void main(String [] args)
          String regex = "[A-Za-z]";
          boolean b = Pattern.matches(regex, "aaaaab");
          if(b==true)
             System.out.println("Its a String Yay!!");
          else
          System.out.println("False!!");
    }The error is with the String regex = "[A-Za-z}"
    this test always returns false, so I have specified the range wrong?! Does anyone know how to specify the range and the like correctly? Sorry if I am being very dumb
    Thank you all for taking the time to view my post
    Regards
    Eggsy

    The expression "[A-Za-z]" mean ONE letter between A-Z or a-z
    If you want one or more letters try "[A-Za-z]+"
    You don't need to test whether a boolean is true just write
    if (b) { ...                                                                                                                                                                                                                                                                                                                                                                           

  • Improving Java Regular Expression Compile Time

    Hi,
    Just wondering if anyone here knows how can i improve the compile time of Java Regular Expression?
    The following is fragment of my code which I tired to see the running time.
    Calendar rightNow = Calendar.getInstance();
    System.out.println("Compile Pattern");
    startCompileTime = rightNow.getTimeInMillis();
    Pattern p = Pattern.compile(reg, Pattern.CASE_INSENSITIVE);
    rightNow = Calendar.getInstance();
    endCompileTime = rightNow.getTimeInMillis();
    Below is fragment of my regular expression:
    (?:tell|state|say|narrate|recount|spin|recite|order|enjoin|assure|ascertain|demonstrate|evidence|distinguish|separate|differentiate|secern|secernate|severalize|tell apart) me (?:about|abou|asti|approximately|close to|just about|some|roughly|more or less|around|or so|almost|most|all but|nearly|near|nigh|virtually|well-nigh) java
    My regular expression is a very long one and the Pattern.compile just take too long. The worst case that I experience is 2949342 milliseconds.
    Any idea how can I optimise my regular expression so that the compilation time is acceptable.
    Thanks in advance

    My regular expression is a very long one and the
    Pattern.compile just take too long. The worst case
    that I experience is 2949342 milliseconds.Wow, that's pretty pathological. I was going to tell you that you were measuring something wrong, because I had written a test program that could compile a 1 Mb "or" pattern (10,000 words, 100 bytes per) in under 200 ms ... but then I noticed that your patterns have two "or" components, so reran my test, and got over 14 seconds to run with a smaller pattern.
    My guess is that the RE compiler, rather than decomposing the RE into a tree, is taking the naive approach of translating it into a state machine, and replicating the second component for each path through the first component.
    If you can create a simple hand-rolled parser, that may be your best option. However, it appears that your substrings aren't easily tokenized (some include spaces), so your best bet is to break the regexes into pieces at the "or" constructs, and use Pattern.split() to apply each piece sequentially.
    import java.util.Random;
    import java.util.regex.Pattern;
    public class RegexTest
        public static void main(String[] argv) throws Exception
            long initial = System.currentTimeMillis();
            String[] words = generateWords(10000);
    //        String patStr = buildRePortion(words);
    //        String patStr = buildRePortion(words) + " xxx ";
            String patStr = buildRePortion(words) + " xxx " + buildRePortion(words);
            long startCompile = System.currentTimeMillis();
            Pattern pattern = Pattern.compile(patStr, Pattern.CASE_INSENSITIVE);
            long finishCompile = System.currentTimeMillis();
            System.out.println("Number of components = " + words.length);
            System.out.println("ms to create pattern = " + (startCompile - initial));
            System.out.println("ms to compile        = " + (finishCompile - startCompile));
        private final static String[] generateWords(int numWords)
            String[] results = new String[numWords];
            Random rnd = new Random();
            for (int ii = 0 ; ii < numWords ; ii++)
                char[] word = new char[20];
                for (int zz = 0 ; zz < word.length ; zz++)
                    word[zz] = (char)(65 + rnd.nextInt(26));
                results[ii] = new String(word);
            return results;
        private static String buildRePortion(String[] words)
            StringBuffer sb = new StringBuffer("(?:");
            for (int ii = 0 ; ii < words.length ; ii++)
                sb.append(ii > 0 ? "|" : "")
                  .append(words[ii]);
            sb.append(")");
            return sb.toString();
    }

  • Logical AND in Java Regular Expressions

    I'm trying to implement logical AND using Java Regular Expressions.
    I couldn't figure out how to do it after reading Java docs and textbooks. I can do something like "abc.*def", which means that I'm looking for strings which have "abc", then anything, then "def", but it is not "pure" logical AND - I will not find "def.*abc" this way.
    Any ideas, how to do it ?
    Baken

    First off, looks like you're really talking about an "OR", not an "AND" - you want it to match abc.*def OR def.*abc right? If you tried to match abc.*def AND def.*abc nothing would ever match that, as no string can begin with both "abc" and "def", just like no numeric value can be both 2 and 5.
    Anyway, maybe regex isn't the right tool for this job. Can you not simply programmatically match it yourself using String methods? You want it to match if the string "starts with" abc and "ends with" def, or vice-versa. Just write some simple code.

  • Java – Regular Expressions – Finding any non digit byte in a multiple byte

    Hello,
    I’m new to JAVA and Regular Expressions; I’m trying to write a regular expression that will find any records that contain a non digit byte in a multiple byte field.
    I thought the following was the correct expression but it is only finding records that contain “all” non digit bytes.
    \D{1,}
    \D = Non Digit
    {1,} = at least 1 or more
    Below is my sample data. I would like the regular expression to find all of the records that are not all numeric. However when I use the regular expression \D{1,} it is only finding the 2 records that all bytes are non digits. (i.e. “ “ and “A “)
    “ 111229”
    “2 111229”
    “20091229”
    “200912c9”
    “201#1229”
    “20101229”
    “20110229”
    “20111*29”
    “20111029”
    “20111229”
    “20B11229”
    “A “
    “A0111229”
    Please note I have also tried \D{1,}+ and \D{1,}? And they also do not return my desired results
    Any assistance someone can provide would be greatly appreciated.

    You don't show the code you are using but I surmise you are using String.matches() which requires that the whole target must match the regular expression not just part of it. Instead you should create a Pattern and then a Matcher and use the Matcher.find() method. Check the Javadoc for Pattern and Matcher and look at the Java regex tutorial - http://docs.oracle.com/javase/tutorial/essential/regex/ .
    P.S. You can re-use the Pattern object - you don't have to create it every time you need one.
    P.P.S. Java regular expressions work with characters not bytes and characters are not not not bytes.

  • Java Regular Expressions in J2EE

    Does anybody know when Java Regular Expressions will be available in J2EE. They are currently in the latest release of J2SE in the java.util.regex package.

    They are in the Standard Edition, so it does not make sense that they will also be in Enterprise Edition some day. You need to have the standard JRE installed before you can use the J2EE classes anyway.
    If you want to use the regular expressions, install version 1.4 (beta) of the J2SE and use the current version of J2EE on top of that.
    Jesper

  • Problems with java regular expressions

    Hi everybody,
    Could someone please help me sort out an issue with Java regular expressions? I have been using regular expressions in Python for years and I cannot figure out how to do what I am trying to do in Java.
    For example, I have this code in java:
    import java.util.regex.*;
    String text = "abc";
              Pattern p = Pattern.compile("(a)b(c)");
              Matcher m = p.matcher(text);
    if (m.matches())
                   int count = m.groupCount();
                   System.out.println("Groups found " + String.valueOf(count) );
                   for (int i = 0; i < count; i++)
                        System.out.println("group " + String.valueOf(i) + " " + m.group(i));
    My expectation is that group 0 would capture "abc", group 1 - "a" and group 2 - "c". Yet, I I get this:
    Groups found 2
    group 0 abc
    group 1 a
    I have tried other patterns and input text but the issue remains the same: no matter what, I cannot capture any paranthesized expression found in the pattern except for the first one. I tried the same example with Jakarta Regexp 1.5 and that works without any problems, I get what I expect.
    I am using Java 1.5.0 on Mac OS X 10.4.
    Thank to all who can help.

    paulcw wrote:
    If the group count is X, then there are X plus one groups to go through: 0 for the whole match, then 1 through X for the individual groups.It does seem confusing that the designers chose to exclude the zero-group from group count, but the documentation is clear.
    Matcher.groupCount():
    Group zero denotes the entire pattern by convention. It is not included in this count.

  • SQL Injection and Java Regular Expression: How to match words?

    Dear friends,
    I am handling sql injection attack to our application with java regular expression. I used it to match that if there are malicious characters or key words injected into the parameter value.
    The denied characters and key words can be " ' ", " ; ", "insert", "delete" and so on. The expression I write is String pattern_str="('|;|insert|delete)+".
    I know it is not correct. It could not be used to only match the whole word insert or delete. Each character in the two words can be matched and it is not what I want. Do you have any idea to only match the whole word?
    Thanks,
    Ricky
    Edited by: Ricky Ru on 28/04/2011 02:29

    Avoid dynamic sql, avoid string concatenation and use bind variables and the risk is negligible.

  • Java BeanShell expression in ODI

    hi experts,
    i am working on ODI 11 g (11.1.1)
    i have found java beanshell expression in standard ODI KM (IKM "IKM Oracle Slowly Changing Dimension", step 192 "Analyze integration table"):
    <%=odiRef.getTable("L","INT_NAME","A").replaceAll("","").replaceAll("..>",".replaceAll(odiRef.getInfo( \\u0022DEST_WORK_SCHEMA\\u0022 )+\\u0022.\\u0022,\\u0022\\u0022)?>")%>
    It translates, for example, "DWH_ETL.I$_SC_INTERMEDIARY" to "I$_SC_INTERMEDIARY"
    Please explain in detail how it works?
    specifically, i don't understand how works the expression:
    replaceAll("..>",".replaceAll(odiRef.getInfo( \\u0022DEST_WORK_SCHEMA\\u0022 )+\\u0022.\\u0022,\\u0022\\u0022)?>")
    Java function "replaceAll" (http://download.oracle.com/javase/6/docs/api/):
    public String replaceAll(String regex,
    String replacement)
    replaces each substring of this string that matches the given regular expression with the given replacement.
    What does mean the expression "..>" in this calling replaceAll?
    it looks like a nested call to the substitution API (http://www.business-intelligence-quotient.com/?p=812)
    thanks in advance

    HI,
    I have re configured as mentioned in your blog . But still getting same exception . Something I missed in my previous thread is below.
    <Sep 19, 2012 3:34:46 PM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "AgentServlet" failed to preload on startup in Web application: "trellisagent".
    ODI-1400: Agent trellisagent start failure: JDBC connection error occurs while connecting to the master repository.
    Caused by: java.security.AccessControlException: access denied (oracle.security.jps.service.credstore.CredentialAccessPermission context=SYSTEM,mapName=oracle.odi.credmap,keyName=SUPERVISOR read)
    at oracle.odi.runtime.agent.servlet.AgentServlet.startup(AgentServlet.java:318)
    at oracle.odi.runtime.agent.servlet.AgentServlet.init(AgentServlet.java:226)
    at javax.servlet.GenericServlet.init(GenericServlet.java:242)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    I am stuck in asituation here :(
    Ashish

  • Adobe Java Script Expressions

    Question #1    I have a check box field and two data fields containing only letters no numbers in an Adobe Acrobat Form. I would like to have a java script expression that if the Check box 1 field is checked, the contents of Data Field 1 will be automatically entered into Data Field 2 .
    Please provide script and below are the 3 fields.
    Check box 1 field: Checked
    Data Field 1
    Data Field 2
    Question #2    I have a field labeled Full Address that I am trying to get the following fields to populate from. The problem in my expression is when there is no Suite then there is an extra comma still showing.
    Please provide script.
    Sample of my script below.
    event.value = this.getField("Merchant_Addr1").value.concat( ", ", this.getField("Merchant_Addr2").value) + ", " + this.getField("Merchant_City").value + ", " + this.getField("Merchant_State").value + "  " + this.getField(" Merchant_Zip").value;
    This is what displays if no Suite is in Address (Two commas after the word Drive: 23175 La King Drive, , Irvine, CA  92656
    Data Field Street Address
    Data Field Suite (If empty then don't show comma)
    Data Field City
    Data Field State
    Data Field Zip

    For question number 2, I would use a reusable document level function to combine 3 fields a time and adjust for null field values.
    // Concatenate 3 strings with separators where needed
    function fillin(s1, s2, s3, sep) {
    Purpose: concatenate up to 3 strings with an optional separator
    inputs:
    s1: required input string text or empty string
    s2: required input string text or empty string
    s3: required input string text or empty string
    sep: optional separator sting
    returns:
    sResult concatenated string
    // variable to determine how to concatenate the strings
      var test = 0; // all strings null
      var sResult; // re slut string to return
    // force any number string to a character string for input variables
      s1 = s1.toString();
      s2 = s2.toString();
      s3 = s3.toString();
      if(sep.toString() == undefined) sep = ''; // if sep is undefined force to null
    assign a binary value for each string present 
    so the computed value of the strings will indicate which strings are present
    when converted to a binary value
      if (s1 != "") test += 1; // string 1 present add binary value: 001
      if (s2 != "") test += 2; // string 2 present add binary value: 010
      if (s3 != "") test += 4; // string 3 present add binary value: 100
      /* return appropriate string combination based on
      calculated test value as a binary value
      switch (test.toString(2)) {
      case "0": // no non-empty strings passed - binary 0
         sResult = "";
      break;
      case "1": // only string 1 present - binary 1
         sResult = s1;  
      break;
      case "10": // only string 2 present - binary 10
         sResult = s2;  
      break;
      case "11": // string 1 and 2 present - binary 10 + 1
         sResult = s1 + sep + s2; 
      break;
      case "100": // only string 3 present - binary 100
         sResult = s3;
      break;
      case "101": // string 1 and 3 - binary 100 + 001
         sResult = s1 + sep + s3; 
      break;
      case "110": // string 2 and 3 - binary 100 + 010
         sResult = s2 + sep + s3; 
      break;
      case "111": // all 3 strings  - binary 100 + 010 + 001
         sResult = s1 + sep + s2 + sep + s3; 
      break;
      default: // any missed combinations
         sResult = "";
      break;
    return sResult;
    var Addr1 = this.getField("Merchant_Addr1").valueAsString;
    var Addr2 = this.getField("Merchant_Addr2").valueAsString;
    var City = this.getField("Merchant_City").valueAsString; 
    var State = this.getField("Merchant_State").valueAsString;
    var Zip = this.getField(" Merchant_Zip").valueAsString;
    var s = fillin(Addr1, Addr2, City, ", ");
    var s = fillin(s, State, "", ", ");
    event.value = fillin(s, Zip, "", "  ");
    Or the custom calculation script could be reduced to:
    // custom calculation script;
    var Addr1 = this.getField("Merchant_Addr1").valueAsString;
    var Addr2 = this.getField("Merchant_Addr2").valueAsString;
    var City = this.getField("Merchant_City").valueAsString;
    var State = this.getField("Merchant_State").valueAsString;
    var Zip = this.getField(" Merchant_Zip").valueAsString;
    event.value = fillin(fillin(Addr1, Addr2, fillin(City, State,"", ", "), "", ", "), Zip, "", "  ");
    Do not forget the fillin function.

  • Validate through Reg Expression

    Hi,
    I have following requirement to be achieved through reg expressions.
    Need to write a boolean method which takes a String parameter that should satisfy following conditions.
    o 20 character length string.
    o First 9 characters will be a number
    o Next 2 characters will be alphabets
    o Next 2 characters will be a number.(1 to 31 or 99)
    o Next 1 character will be an alphabet
    o Last 6 characters will be a number.
    JDev 11.1.1.6.0

    Hi,
    Hope following links are useful
    https://blogs.oracle.com/shay/entry/regular_expression_validation
    http://www.vogella.com/articles/JavaRegularExpressions/article.html

  • Java regular expression for Arabic

    i want to use java regular expression to evaluate some string in Arabic
    can some body tell me how to do a match for arabic characters

    i have this code :
    String poem="���";
          //String m1="\\p?";   
           String m1= "\\p{�}";
            Matcher m =
          Pattern.compile(m1)
            .matcher(poem);
        while(m.find()) {
          for(int j = 0; j <= m.groupCount(); j++)
            System.out.print("[" + m.group(j) + "]");
          System.out.println();
        }i get the error:
    Exception java.util.regex.PatternSyntaxException: Unknown character property name {?} near index 2
    \p?
    if you find that is hard to help with Arabic regex, can someone post a code on how to match Arabic regex or chineese or any thing not latin regex match
    because a need to match a Strings in Arabic if some one can tell me how?

  • Perl Regular expression to java Regular Expression

    HI all,
    How can i write java Regular expression for the below Perl Code
    where data.html is my original Html file
    and data2.html is output file.
    open(FPR, "data.html") || die("Could not open data file");
    while ($line=<FPR>) {
    $content .= $line;
    close(FPR);
    open(FPR, ">data2.html") || die("Could not open data2 file");
    # clean white spaces
    $content =~ s/[\n\r\0 ]//g;
    # divide data by td
    $rxp='<tr.*?><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><td.*?>(.*?)<\/.*?td><\/.*?tr>';
    while ($content=~ m/$rxp/g)
    print FPR "\n".$1."\t".$2."\t".$3."\t".$4."\t".$5."\t".$6."\t".$7."\t".$8."\t";
    print FPR "<br>";
    close(FPR);
    can you help in this regard
    Thanks

    I am able to retrive only one row in this format from data.html file
    <trvalign=middlebordercolor=#ffffff><tdwidth='40'CLASS='tdbgpricespagecolorgrey'><fontface='Arial,Helvetica,sans-serif'size='2'>SB</font></td><t
    dwidth="23"Class=tdbgpricespagecolorgrey><fontface='Arial,Helvetica,sansserif'size='2'>USAirways</font></td><tdwidth="34"Class=tdbgpricespagecolorgrey><fontface='Arial,Helvetica,sans-serif'size='2'>MIA</font></td><tdwidth="31"Class=tdbgpri
    cespagecolorgrey><fontface='Arial,Helvetica,sans-erif'size='2'>LGW</font></td><tdwidth="23"Class=tdbgpricespagecolorgrey><fontface='Arial,Helvetica,sans-serif'size='2'>USAirways</font></td><tdwidth="34"Class=tdbgpricespagecolorgrey><fontface='Arial,Helvetica,sans-serif'size='2'>LGW</font></td>
    But i need the output in this format
    <fontface='Arial,Helvetica,sans-serif'size='2'>SB     <fontface='Arial,Helvetica,sans-serif'size='2'>USAirways     <fontface='Arial,Helvetica,sans-serif'size='2'>MIA     <fontface='Arial,Helvetica,sans-serif'size='2'>LGW     <fontface='Arial,Helvetica,sans-serif'size='2'>USAirways     <fontface='Arial,Helvetica,sans-serif'size='2'>LGW     <fontface='Arial,Helvetica,sans-serif'size='2'>MIA          <br>
    <fontface='Arial,Helvetica,sans-serif'size='2'>CS     <fontface='Arial,Helvetica,sans-serif'size='2'>USAirways     <fontface='Arial,Helvetica,sans-serif'size='2'>MIA     <fontface='Arial,Helvetica,sans-serif'size='2'>LON     <fontface='Arial,Helvetica,sans-serif'size='2'>USAirways     <fontface='Arial,Helvetica,sans-serif'size='2'>LON     <fontface='Arial,Helvetica,sans-serif'size='2'>MIA          <br>
    How can i rewrite the code to achive this.
    Here is my java code
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class parseHTML {
    public static void main(String[] args)
    try
    BufferedReader in = new BufferedReader(new FileReader("C:\\data.html"));
    PrintWriter out = new PrintWriter(new FileWriter("C:\\data1.html"));
    String aLine = null;
    String abc=null;
    String pattern1 ="<tr.+?><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td><td.+?>(.+?)</.+?td>++";
    Pattern p1 = Pattern.compile(pattern1);
    while((aLine = in.readLine()) != null)
    abc=aLine.replaceAll("(\n|\t|\r)","").replaceAll(" ","");
    Matcher m1 = p1.matcher(abc);
    if(m1.find())
    System.out.println("the value is...."+m1.group());
    out.print(m1.group());
    m1.reset(aLine);
    in.close();
    out.close();
    catch(IOException exception)
    exception.printStackTrace();
    Thanks

  • Reg Expression in af:validateRegEx

    Since I can't use my custom validator class (See post Custom validator closes dialog on failure I am trying to use the same regular expression in an <af:validateRegExp> on an <af:inputText>.
    I have tested my regular expression in a completely separate tester that I wrote and it works for every test case I throw at it.
    I put the regular expression inside my custom validator class and it works as expected as well, but I can't use it for above posted reasons.
    So now I've put the regular expression in my backing bean as a private attribute and created a getter method for it. In the validationRegExp component, I used an EL expression to point to the attribute in my backing bean. When I run and put in the same test values, they fail validation.
    The documenation for the validateRegExp says it uses java regular expression syntax, so I shouldn't have to change the regex between the custom validator and the validator component.
    Any ideas?
    Al

    What doesn't work:
    Every success test value that I put in the input text box fails validation. Or maybe I should say that every value I put in the input text box fails validation, although one would expect the failure test value to fail validation, so obviously the issue is that a valid success test value fails validation using the <af:validateRegEx> component with the same regex used in the custom validation class where the same input passes validation.
    What is the issue I see:
    That success test values fail validation using the <af:validateRegEx> component.
    Implentation:
    <af:popup id="resetPasswordPopup"
              binding="#{pageFlowScope.backing_Bean.resetPasswordPopup}">
    <af:dialog id="resetPasswordDialog" type="none"
               title="Reset Password">
    <af:panelGroupLayout layout="vertical">
    <af:outputText value="Enter temporary password for user:"/>
    <af:spacer width="10" height="10"/>
    <af:inputText label="Temporary Password"
                  value="#{pageFlowScope.backing_Bean.temporaryPassword}"
                  required="true">
    <af:validateRegExp pattern="#{pageFlowScope.backing_Bean.passwordRegEx}"
                       hint="Password should be ...."/>
    <!--<f:validator validatorId="passwordValidator"/>-->
    </af:inputText>
    </af:panelGroupLayout>
    <f:facet name="buttonBar">
    <af:panelGroupLayout layout="horizontal" halign="center">
    <af:commandButton text="Yes"
                      action="resetUserPassword"
                      partialSubmit="true"/>
    <af:spacer width="10" height="10"/>
    <af:commandButton text="No" immediate="true">
    <af:returnActionListener/>
    </af:commandButton>
    </af:panelGroupLayout>
    </f:facet>
    </af:dialog>
    </af:popup>

  • CFINPUT Reg Expression Validation Pattern Help

    I've got a form with a non-required field that needs to meet
    some validation requirements (Numbers, Letters, 'space character'
    or 'blank, empty string' only) if the user chooses to fill it
    out...
    I'm using CFINPUT tag with the following settings, does my
    Reg Expression pattern look OK?
    REQUIRED="No"
    VALIDATE="regular_expression"
    PATTERN="^[a-zA-Z *]{1,40}$"
    MAXLENGTH="40"
    Thanks for any help. I'm v. new to regular expressions (10
    hrs education at Google Univ.)
    Sincerely,
    Paul Cross

    I think you want something more like this:
    ^[a-zA-Z0-9 ]{0,40}$

Maybe you are looking for