PHP Regular Expression of URL in text

I have some text that is displaying from a database table and
inside
that text is a web address (i.e.,
http://www.whateverthisaddressis.com).
I'd like to know if anyone has a code out there to where php
can find
text with a
http:// or www. and change it into a link
automatically. I
know there's many out there, but I don't have a clue what I'm
looking at
and where to put it.
Any help would be greatly appreciated!
Toad78

You might find something here:
http://ca3.php.net/preg_replace

Similar Messages

  • PHP regular expression to JSP?

    Hi there,
    I have the following PHP regular expression, and was looking for tips on how to create an equivalent in JSP using the 1.3.1 API. This has been causing me problems since the regex package didn't arrive until 1.4.
    preg_match("/^(([\w\-\_])+(\.)*)+\@([\w\-\_]+\.)+[A-Za-z]{2,}$/i", $theAddress)Basically, it checks to make sure a valid email address pattern has been input.
    Any help would be appreciated!
    Thanks!

    Though I donno about PHP and the related stuff that you've posted, I can help you by providing a JS function that you can invoke to check for the valid format of an e-mail ID, I guess if this is what you want.
    function isEmail (s)
        // there must be >= 1 character before @, so we
        // start looking at character position 1
        // (i.e. second character)
        var i = 1;
        var sLength = s.length;
        // look for @
        while ((i < sLength) && (s.charAt(i) != "@"))
        { i++
        if ((i >= sLength) || (s.charAt(i) != "@")) return false;
        else i += 2;
        // look for .
        while ((i < sLength) && (s.charAt(i) != "."))
        { i++
        // there must be at least one character after the .
        if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
        else return true;
    }'s' is the e-mail ID string that you want to check.
    Hope you're assisted.
    fun_one

  • Regular expressions for URLs to match extensions

    I am working on a simple method that will assign a specific extension
    (e.g. ".jsp", ".php", ".cfm", etc.) to the end of a URL if it doesn't
    find anything marking a valid extension, however, I do not want to add
    an extension if one is found.
    Consider my code:
    import java.util.regex.Pattern;
    public static final String urlEndSlashPattern = "/?";
    public static final String urlQSPattern = "\\??([a-zA-Z0-9\\-_\\.]
    +=[^&]*&?)*";
    public static final String urlAnchorPattern = "#[^#]*$";
    public static void addExtToUrl(String url, String myExt, String[]
    exts) {
       StringBuffer sb = new StringBuffer();
       boolean hasExt = false;
       for (int i = 0; i < exts.length; i++) {
    sb.append(".").append(exts).append(urlEndSlashPattern).append(urlQSPatte�rn).append(urlAnchorPattern);
    if (Pattern.matches(sb.toString(), url)) {
    hasExt = true;
    sb = new StringBuffer();
    if (!hasExt) {
    url += "." + myExt;
    The issue I want to bring up is the regular expression pattern I'm
    using appears to fail.  I want to check and see if the URL I provide
    ends with a valid extension, followed by optional "/" or a query
    string or an anchor or any combination of these.
    Like say if I have
    http://www.blah.com/index.html
    Then don't add the ".jsp" extension
    But if I have
    http://www.blah.com/registration/
    Then I *want* to add the ".jsp" extension:
    http://www.blah.com/registration.jsp
    Or if I have:
    http://www.blah.com/registration/?foo=bar#baz
    Then it needs to change to
    http://www.blah.com/registration.jsp?foo=bar#baz
    But if I have
    http://www.blah.com/registration/index.php?foo=bar#baz
    Then I do *not* add the ".jsp" extension.
    Hope that makes sense now.  Bottom line is that the pattern above
    doesn't seem to work.  Ideas?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Ok, just for fun, let's try it.
    URL: http://www.blah.com/?bar=baz#anchor
    Absolutely valid URL and something possible (remember, Balus, this is from a database entry, thus, it can be anything at all!)
    Let's split onto the last /
    Your last entry will be
    ?bar=baz#anchor
    So if I re-insert the .jsp that it would not find I get
    http://www.blah.com/.jsp?bar=baz#anchor
    INVALID URL
    Now let's try this one, BalusC:
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus/
    Now we split according to the ... last /
    http://www.blah.com/index.jsp?forwardURL=http://www.wee.com/gotcha_balus.jsp
    Valid URL, but possibly wrong when the query string value for "forwardURL" is read, thus, making the URL ultimately wrong.
    Two examples that show that splitting by the last / can't work here.

  • Regular expression alarm url

    Hi,
    I have a problem with regular expression. I would like to filter only the name of a dsc alarm url: \\EW-MONITOR\monitor\000_t-ist_STB-M1-AS.Alarms.HI should be 000_t-ist_STB-M1-AS . Has somebody an hint for me?
    Best Regards,
    Joachim
    Solved!
    Go to Solution.

    Joachim082 wrote:
    Hi,
    I have a problem with regular expression. I would like to filter only the name of a dsc alarm url: \\EW-MONITOR\monitor\000_t-ist_STB-M1-AS.Alarms.HI should be 000_t-ist_STB-M1-AS . Has somebody an hint for me?
    Best Regards,
    Joachim
    What will be constant in the name?  Will it always be between "monitor/" and ".Alarms"?  Will the format always be "###_<some text>_<other text>"?
    This will be easy once I know what to look for.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Using Regular Expressions to Find Quoted Text

    I have run into a couple problems with the following code.
    1) Slash-Star and Slash-Slash commented text must be ignored.
    2) It does not detect backslashed quotes, or if that backslash is backslashed.
    Can this be accomplished with Regular Expressions, or should I implement this using if/indexOf logic?
    Thank You in advance,
    Brian
        * Finds position of next quoted string in a line
        * of source code.
        * If no strings exist, then a Pointer position of
        * (0,0) is returned.
        * @param startPos position to start search from
        * @param argText  the line of text to search
        * @returns next string position
       public Pointer getQuotedStringPosition(int startPos, String aString) {
          String argText = new String( aString );
          Pattern p = Pattern.compile("[\"][^\"]+[\"]");
          Matcher m = p.matcher( argText.substring(startPos); );
          if( m.find() )
             return new Pointer( m.start() + startPos, m.end() + startPos );
          else
             return new Pointer( 0, 0 ); // indicates nothing was found
       }

    YATArchivist was right about the regular expressions.
    I think I've got it but somebody test it if you want. Let me know what you find.
    I've included a barebones Position class as well...
    import java.util.regex.*;
    import java.io.*;
    import java.util.*;
      @author Joshua A. Logan, Jr.
    public class RegexTest
       private static final String SLASH_SLASH = "(//.*)";
       private static final String SLASH_STAR =
                               "(/\\*(?:[^\\*]|(?:\\*(?!/)))+(\\*/)?)";
       private static final Pattern COMMENT_PATTERN =
                         Pattern.compile( SLASH_SLASH + "|" + SLASH_STAR );
       private static final Pattern QUOTED_STRING_PATTERN =
                      Pattern.compile( "\"  ( (?:(\\\\.) | [^\\\"])*+  )     \"",
                                       Pattern.COMMENTS );
       // Breaking the above regular expression down, you'd have:
       //   "  ( (?: (\\ .)  |  [^\\ "]  ) *+ )   "
       //   ^          ^     ^     ^       ^      ^
       //   |          |     |     |       |      |
       //   1          2     3     4       5      6
       // which matches:
       // 1) The starting quote...
       // Followed by something that is either:
       // 2) some escaped sequence ( e.g. _\n_  or even _\"_ ),
       // 3)                ...or...
       // 4) a character that is neither a _\_ nor a _"_ .
       // 5) Keep searching this as much as possible, w/o giving up
       //                    any found text at the end.
       //        Note: the text found would be in group(1)
       // 6) Finally, find the ending quote!!
       public static Position [] getQuotedStringPosition( final String text )
          Matcher cm = COMMENT_PATTERN.matcher( text ),
                  qm = QUOTED_STRING_PATTERN.matcher( text );
          final int len = text.length();
          int startPos = 0;
          List positions = new ArrayList();
          while ( startPos < len )
             if ( cm.find(startPos) )
                int commStart = cm.start(),
                    commEnd   = cm.end();
                // are we starting @ a comment?
                if ( commStart == startPos )
                   startPos = commEnd;
                else if ( qm.find(startPos) )
                   // Search for unescaped strings in here.
                   int stringStart = qm.start(1),
                       stringEnd   = qm.end(1);
                   // Is the quote start after comment start?
                   if ( stringStart > commStart )
                      startPos = commEnd; // restart search after comment end...
                   else if ( (stringEnd > commEnd) ||
                             (stringEnd < commStart) )
                      // In this case, the "comment" is actually part of
                      // the quoted string. We found a match.
                      positions.add( new Position(text, qm.group(1),
                                                  stringStart,
                                                  stringEnd) );
                      int quoteEnd = qm.end();
                      startPos = quoteEnd;
                   else
                      throw new IllegalStateException( "illegal case" );
                else
                   startPos = commEnd;
             else
                // no comments were found. Search for unescaped strings.
                int quoteEnd = len;
                if ( qm.find( startPos ) ) {
                   quoteEnd = qm.end();
                   positions.add( new Position(text,
                                               qm.group(1),
                                               qm.start(1),
                                               qm.end(1)) );
                startPos = quoteEnd;
          return positions.isEmpty() ? Position.EMPTY_ARRAY
                                     : (Position[])positions.toArray(
                                              Position.EMPTY_ARRAY);
       public static void main( String [] args )
          try
             BufferedReader br = new BufferedReader(
                      new InputStreamReader(System.in) );
             String input = null;
             final String prompt = "\nText (q to quit): ";
             System.out.print( prompt );
             while ( (input = br.readLine()) != null )
                if ( input.equals("q") ) return;
                Position [] matches = getQuotedStringPosition( input );
                // What does it do?
                for ( int i = 0, max = matches.length; i < max; i++ )
                   System.out.println( "-->" + matches[i] );
                System.out.print( prompt );
          catch ( Exception e )
             System.out.println ( "Exception caught: " + e.getMessage () );
    class Position
       public Position( String target,
                        String match,
                        int start,
                        int end )
          this.target = target;
          this.match = match;
          this.start = start;
          this.end = end;
       public String toString()
          return "match==" + match + ",{" + start + "," + end + "}";
       final String target;
       final int start;
       final int end;
       final String match;
       public static final Position [] EMPTY_ARRAY = { };
    }

  • Regular expression in url-pattern in web.xml

    hi,
    could any tell me the is web.xml accepts regexp(except wild card) in it's url-pattern attribute. I want to put regular expression (except wildcard, i know it supports) as [a-zA-Z]+ like in url-pattern in servlet-mapping. I tried this :
    <servlet-mapping>
    <servlet-name>AppDnldMain</servlet-name>
    <url-pattern>/[a-zA-Z]+/?</url-pattern>
    </servlet-mapping>
    But it dint work.. I dont know whether i processed in right way. Any suggestion are most welcome..

    No it does not accept wild card.
    Servlet specification section SRV.11.2
    In theWeb application deployment descriptor, the following syntax is used to define
    mappings:
    • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used
    for path mapping.
    • A string beginning with a ‘*.’ prefix is used as an extension mapping.
    • A string containing only the ’/’ character indicates the "default" servlet of
    the application. In this case the servlet path is the request URI minus the context
    path and the path info is null.
    • All other strings are used for exact matches only.
    If you want regex matching, you can match all urls to a single servlet, and then use request.getRequestURI and do regex on that in your code.
    Cheers,
    evnafets

  • Regular expressions for URLs

    Hi everyone,
    I have a question about regular expressions.
    Let's say I want my program to extract last 10-digits from any URL that will be found (every found URL will end up on 10digit number!) and insert that number in the middle of other URL.
    Would anyone tell me please how to do that?
    Thank you

    I am not sure how to do that either...
    Actually I just figured out that there is no garantee that the URL will be ended on 10-digit number.
    Ok, my program is meant to search for the movie info on Yahoo (user enters keyword to search and chooses either 'title', 'actor', 'trailer', 'review' in drop-down menu). After the 'search' button is clicked the appropriate page is supposed to be found.
    For example, if the user types in 'shrek' and chooses 'trailer', the result is supposed to be this link http://movies.yahoo.com/movie/1808405861/trailer and not the
    following ones:
    http://movies.yahoo.com/mv/search?p=shrek
    or
    http://movies.yahoo.com/shop?d=hv&cf=info&id=1808405861
    So in my program the line for the 'title' search is
    url = "http://movies.yahoo.com/mv/search?type=all&p=";and it works for the titles. I thought if the found link has 10 -digit number on the end I can somehow 'catch' that number and insert into another link -so the page with trailers would be pulled up (it's an ID number in yahoo database) .
    But now since I am not sure if 10-digit number is going to be in the found link at all, I have no idea how to 'catch' that number.
    Does anyone have any ideas for my case?

  • PHP Regular Expressions

    I am trying to write a script that searches for image tags
    and checks for alt tags within them. I am using preg_match_all to
    find all the img tags but i am messing up somewhere on my regular
    expression pattern.
    I seriously just started learning these expressions days ago
    so i really do not know what i am doing here. For some reason my
    current expression: /<img.+\/>./ Doesnt find the next >
    after finding the first <img tag. It gets like the second or
    third one. Shouldnt it cut it off after it finds the first >?
    In addition, my other expression (for extracgting the src tag
    doesnt stop after the second quatation. Insead it goes for a few
    more. /src=\".*\"/ is what i have now.
    What do i need to fix so that the results i get back dont
    include anything after the first > or the second quation
    mark?

    barbedwire103 wrote:
    > What do i need to fix so that the results i get back
    dont include anything
    > after the first > or the second quation mark?
    /<img[^>]+>/
    /src\s?=\s?"[^"]+"/
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Getting the regular expression from the given text

    Hi
    I need to develope an application which can convert the given text into the regular expression. I need that when i enter any text in textarea that should be translated into regular expression in another panel. but i could not find the method or technique which can do so. plz help me to resolve this issue.
    Thanks Imran khan.

    well, there are an infinite number of regular expressions for an arbitrary piece of text, so you will have to qualify in your mind what the purpose of the regular expression is.
    For instance, it is trivial to create a regex for a string just by copying the input text, and inserting \ before any special characters. But this pattern would probably be quite silly.

  • Need a regular expression for URL

    Regular expression: ^(udp|norm)://(?:(?:25[0-5]|2[0-4]\\d|[01]\\d\\d|\\d?\\d)(?(?=\\.?\\d)\\.)){4}:(6553[0-5]|655[0-2][0-9]\\d|65[0-4](\\d){2}|6[0-4](\\d){3}|[1-5](\\d){4}|[1-9](\\d){0,3})$
    Source: udp://125.3.4.121:23456
    Getting error:java.util.regex.PatternSyntaxException: Unknown inline modifier near index 54
    ^(udp|norm)://(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}:(6553[0-5]|655[0-2][0-9]\d|65[0-4](\d){2}|6[0-4](\d){3}|[1-5](\d){4}|[1-9](\d){0,3})$

    paulcw wrote:
    I can't help wondering if a simpler solution would involve creating a java.net.URL object, passing it the string to be checked, and let URL do the parsing and an initial pass at checking the syntax. Then you could query URL for individual components for further checking (e.g., getting the transfer type to make sure it's one of the kinds you want). This approach would probably be more self-documenting, if nothing else.Nice idea, but java.net.URL doesn't actually do much work at all. It basically takes the protocol part, looks up a handler for it, and delegates everything else to that. The handlers themselves are down in the sun packages (or whatever your Java impl is) and since there isn't one for the OPs protocol, he'd have to write and register his own anyway, which kind-of negates the entire purpose of leveraging it.
    @OP: Paul's suggestion can still be of use. Apache, Codehaus and the like will have written their own protocol handlers, it's worth grabbing the source code for, say, Apache HttpClient, and seeing if they've got anything useful in there. Then again, who's to say that what's a valid URL for this 'norm' protocol, other than whoever designed the protocol?

  • Regular Expressions for converting HTML to Structured Plain Text

    I'm writing a PL/SQL function that will convert HTML to plain text, but still preserve some of the formatting/line breaks. One of my challenges is in writing a regular expression to capture the text blocks while ignoring the markup. I'm trying to write an expression that will grab all of the text between start/end tags, but discard the tags. For example, to find all of the text between a start/end paragraph, I want to do something like:
    REGEXP_REPLACE('&lt;p style=&quot;text-align:center&#59;&quot;&gt;This is the body of the paragraph&lt;/p&gt;', '&lt;p.*&gt;(.*)&lt;/p&gt;', '\1||v_crlf' )
    where \1 returns the contents of the paragraph and v_crlf (declared earlier in the function) inserts a line break. I know there are more general expressions that will remove all tags, but I want to specifically identify the tags so I can process them appropriately. This way I can easily convert HTML to plain text for email and reporting without having to keep two versions around. Any help would be greatly appreciated. Once I get this worked out, I will repost with the function code for others to use. Thanks.
    Edited by: jritschel on Oct 26, 2010 9:58 AM

    Here's a function I wrote for an app. I'm not making in promises on it's accuracy as the app was just a proof of concept and never made it to production.
    function strip_html( p_clob in clob )
    return clob
    is
        l_out clob;
        l_test  number := 0;
        l_max_loops constant number := 20;
        i   pls_integer := 0;
    begin
        l_out := regexp_replace(p_clob,'<br>|<br />',chr(13)||chr(10),1,0,'imn');
        l_out := regexp_replace(l_out,'<p>',chr(13)||chr(10),1,0,'imn');
        l_out := replace(l_out,'<li>',chr(13)||chr(10)||'*<li>');
        l_out := regexp_replace(l_out,'<b>(.+?)</b>','*\1*',1,0,'imn');
        l_out := regexp_replace(l_out,'<u>(.+?)</u>','_\1_',1,0,'imn');
        loop
            l_test := regexp_instr(l_out,'<([A-Z][A-Z0-9]*)[^>]*>.*?</\1>',1,1,0,'imn');
            exit when l_test = 0 or i > l_max_loops;
            l_out := regexp_replace(l_out,'<([A-Z][A-Z0-9]*)[^>]*>(.*?)</\1>','\2',1,0,'imn');
            i := i + 1;
        end loop;
        return l_out;
    end strip_html;{code}
    The loop is there to handle nested HTML.
    Tyler Muth
    http://tylermuth.wordpress.com
    "Applied Oracle Security: Developing Secure Database and Middleware Environments": http://sn.im/aos.book
    Edited by: Tyler on Oct 26, 2010 10:03 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Url pattern tag and regular expression

    I am trying to set up my web.xml in Tomcat 4.1.3 container to go to one page if letters are entered in last part of url or go to another page if numbers are entered in the last part of a url.
    For example if here is how the url would be set up where the url will go to either the all numbers location or the non numbers location:
    Any number entry for last part of url which could be something like 343
    http://127.0.0.1:8080/theapp/pack/weburl/343
    Any non number entry for last part of url which could be something like abec
    http://127.0.0.1:8080/theapp/pack/weburl/abec
    My attempt below is not working because it doesnt seem to take the regular expressions. But if I manually put in letters such as: <url-pattern>/pack/weburl/ab</url-pattern> it would take me to the correct page. How does web.xml work with regular expressions inthe url-pattern tag??
    <servlet>
    <servlet-name>Number</servlet-name>
    <servlet-class>pack.Number</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Number</servlet-name>
    <url-pattern>/pack/weburl/\d*</url-pattern>
    </servlet-mapping>
    <servlet>
    <servlet-name>NotNumber</servlet-name>
    <servlet-class>pack.NotNumber</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>NotNumber</servlet-name>
    <url-pattern>/pack/weburl/[A-Za-z]</url-pattern>
    </servlet-mapping>

    Sorry, this pattern can't take regular expressions.
    Referring to the servlet spec section 11.2 which defines these mappings
    In the web application deployment descriptor, the following syntax is used to define
    mappings:
    � A string beginning with a �/� character and ending with a �/*� postfix is used
    for path mapping.
    � A string beginning with a �*.� prefix is used as an extension mapping.
    � A string containing only the �/� character indicates the "default" servlet of the
    application. In this case the servlet path is the request URI minus the context
    path and the path info is null.
    � All other strings are used for exact matches only.As an alternative, I would suggest that you match the request to a filter, and then use some logic based on request.getURI() to determine which resource to forward to from there.

  • Regular expression for html links

    Hi, I'm trying to get text/link pairs from a string, accepted links
    are like:
    text1
    text2
    The expected result would be:
    url: url1
    Text: text1
    url: url2
    Text: text2
    I use the following regular expression to catch the texts and the urls:
    "<a href=\"*(.*)\"*.*>(.*)</a>"
    group(1) should be the url and group(2) the text.
    But it doesn't work ok, I got something like:
    url: http://url1/" garbagetags
    text: text1
    url: utl2
    text: text2
    I'm trying to avoid links with " and without it and dinamic html
    tags.
    I think the problem is the Regular Expression string, I'm new using
    them and I can't found the right one, if you know what's wrong with
    my R.E. string, please help me.!
    thanx

    Had to break it in to two regular expressions:
    import java.util.regex.*;
    class B2  {
       public static void main(String[] args) {
            //String INPUT = "<a href=\"http://url1/\" garbagetags>text1</a>";
            //String INPUT = "<a href=url2>text2</a>";
            //String INPUT ="<a href=\"http://www.google.com\">Google search engine</a>";
              String INPUT="<a id=1a class=q href=\"/imghp?hl=en&tab=wi&ie=UTF-8&oe=UTF-8\" onClick=\"return c('www.google.com/imghp','wi',event);\"><font size=-1>Images</font></a>";
            //String REGEX = "<a .*href=\\\"?h?t?t?p?:?/?/?([\\w\\.\\?\\&=\\-\\d]*)/?\\\"?.*>(.*)</a>";
            String REGEX = "<a .*href=\\\"?h?t?t?p?:?/?/?([\\w\\.\\?\\&=\\-\\d]*)/?\\\"?.*>";
            String REGEX2 = ">\\b([\\w\\s\\d]+)\\b<";
            Pattern p = Pattern.compile(REGEX);
            Matcher m = p.matcher(INPUT);
            StringBuffer sb = new StringBuffer();
            if ( m.find() ) {
            System.out.println(m.group(1) + "     " );  }
            else { System.out.println("No MAtch found");  }
            Pattern p2 = Pattern.compile(REGEX2);
            Matcher m2 = p2.matcher(INPUT);
            if ( m2.find() ) {
            System.out.println(m2.group(1) + "     " );  }
            else { System.out.println("No MAtch found");  }
    } You do realize that you'll never get 100% accuracy with this. There are too many possible variations to account for them all.

  • Regular expressions over objects?

    Hello everybody,
    following problem: I'm working on a project related to natural language processing and I need to match patterns against sentences. The patterns would be like the following example: "<NOUN> is just <VERB> with <NOUN> (and <CONNECTIVE> <NOUN>)*". Thus, each token in the regexp represents either a word or a class of words. Each token (word) would be represented as an object and it is possible to define equality relation on these objects. Now, does anybody here know about a regexp library, which would allow this? All the regexp libraries I've seen sofar are only working on a text. But I need a library, which would work on sequencies of objects, and the programmer would provide a method saying whether two objects are equal or not. Is there any such library? I don't have time to write it for myself.

    Actually, I think you need EBNF not regex.
    EBNF - Extended Backus-Naur Form - deals with definitions which include synbols which then have their own definitions. A 'rule' is a mapping from a 'symbol' to an 'expression'. A set of rules is known as a 'grammar'. Some of the expressions could contain regex if it respresents a String.
    regex - Regular Expressions - are just for text patterns.
    I haven't seen any EBNF (or BNF) programs, but I haven't searched too much for them either. Hopefully this will help point you toward more successfull searches.
    I have written some EBNF representations in Java, but they were for specialized uses with other code as part of the classes and so they could be applied generally to your needs.

  • AutoVue 20.2.1 - ABV - Regular Expressions

    All,
    We have implemented the ABV/HotSpots feature and there is a regular expression we have defined that should work but isn't.
    Regular Expression:
    ^[0-9]{5}$
    Text:
    00345
    Using http://www.regular-expressions.info/javascriptexample.html to test it works seems is fine. So a00345, 00345a, 0a0345, test 00345 ALL fail which is what i want.
    But when i setup the hotspot definition with the above it doesn't match the cases in the PDF document.
    If i remove the ^ and $ then it does match but it matches cases i do not want (example: DVA-AB-12345)
    I want 5 number and that is it, nothing before or after.
    I am confused as to why the regular expression tester is saying it is fine and then AutoVue HotSpots fails it.
    I have thought about case sensitive and and either way true or false we are using numbers so it shouldn't affect things.
    Can anyone help?
    Nick

    Hi Nick,
    Currently, there is no way for you to specify which characters to highlight within the regular expression.
    Theoretically, it could be done through regex groups: (^|\s)(\d{4})(\s|$), highlight group # 2.
    We would need to enhance our API to accept the group index to highlight.
    Please log an enhancement request for this feature. I'm sure it will be very useful!
    Thanks,
    George

Maybe you are looking for

  • Mixing RAM in Mac Pro

    Hey guys, I got a 2009 Mac Pro with OEM 3gb memory installed! Im planning to install 1333mhz suportive processor eventually, so so I will buys a 1333mghz memory right now. Will it be OK if Ill install 8GB 1333mhz alongside my OEM 3x1GB 1066mhz RAM? A

  • Nokia Music Licence issue

    rather annoying problem. I downloaded some tracks from the Nokia music store onto my 5800. Each time i did a software update i lost the licences for the tracks. even though i had backed up the phone beforehand. No Problem, i just re downloaded the li

  • SJWS 6.1 Policy Agent getting roles

    Hi, I've installed Policy Agent 2.2 in SJWS 6.1 and authentication is working properly. I've configured nativeRealm to get the user's principal from a web application (a servlet). In this scenarios the user has two roles (it's working on WebLogic 8.1

  • Delta are pointing Old BW system instead of new BW system

    Hi, We are doing upgrade and as part of upgrade BI 7.0 we have copied existing BW system into new BW system. I have a extracted data from R/3 to BI system.All the full loads went through successful except Delta data load into BI system. Delta data so

  • How to identify the CAN hardware connected to the PC

    Hi      Is there any way to identify the CAN devices to the PC via USB port, I am able to see the connected CAN hardware name in the device manager list. Same I would like to read using LabVIEW. Regars Visuman Solved! Go to Solution.