Regex convert URL's to link if NOT wrapped in quotes

Hi there,
Regular expressions have always been very difficult for me to understand. I currently have a regular expression to search a long string and replace URL's with HTML code to convert to a link. So...
http://java.sun.com would become:
<a href="http://java.sun.com">http://java.sun.com</a>It works EXCELLENT, however, I allow users to enter in HTML code for images using the following...
<img src="http://www.url.to.image.com/image.gif">But, my regex replaces the URL with the link code above. To fix this, I want to simply only replace URL's with the HTML a href code if the URL is NOT surrounded by quotes. As I said above, I'm not good with regular expressions. The one I'm currenlty using was found on a forum too. Does anyone know how to accomplish this? Thanks very much, I appreciate it!

scoobasteve1982 wrote:
Can you or anyone else suggest a good place to learn more about regex...something that starts with the VERY BASICS? Thanks again!~Sure.
The website regular-expressions.info has a chapter about Java regex:
[http://www.regular-expressions.info/java.html]
But I recommend you to have a look at the other sections of that site too.
And Sun has a tutorial about their own regex-api, of course:
[http://java.sun.com/docs/books/tutorial/essential/regex/]
May the dark regex force be with you!
; )

Similar Messages

  • Regex for url pattern validation

    Hi,
    I am trying to find a regex for Url pattern validation that is not too restrictive.
    Please let me know, if anyone is using a pattern for their applications.
    Thanks
    Mayank Sharma

    are you talking about xml schema restriction?
    <xs:element name="url">
      <xs:simpleType>
       <xs:restriction base="xs:string">
        <xs:pattern value="(https?://)?[-\w.]+(:\d{2,5})?(/([\w/_.]*)?)?" />
       </xs:restriction>
      </xs:simpleType>
    </xs:element>

  • Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?

    Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?
    Depending on the system version, and Office Word version:
    - a pure URL link starting with http or even www sometimes works in PDF, either produced by Aperçu or Adobe, sometimes does not work;
    - other kind of links where the text under display is not a URL, never work!
    I like everything with Apple computers and software, except PDF generation. Output files are usually bigger in size, and no better quality, than under Windows. Furthermore, it is weird that something as common as hyperlinks does not work correctly!
    I related this question with Mac OS X Snow Leopard, but the problem is still there with Mac OS Lion.
    This problem seems to have been around for years, without any proper solution from Apple and/or Adobe! To me, this is very embarrassing!

    Greetings NoNameGiven,
    If I understand the problem correctly (I’m not sure I do) you would prefer ‘iii’ to be read as “eye eye eye” rather than “three”? The alt text property is the only way that I know of to make this happen. Hope this helps.
    a ‘C’ student

  • Firefox does not allow me to 'paste' url's/rapidshare links anywhere on the web browser.

    I noticed this problem when I purchased a Rapidshare account. In Google i found the URL of a movie>highlight the link>copy>but the 'paste' option is blanked out (not available) when i come to paste the link in the web browser. I have tried ctrl-v and also the edit>paste but the 'paste' icon i always 'greyed' or blanked out. This problem does not occur on any other computer in the house, just on my laptop. It only occurs with rapidshare links (and similar URL's). I can not paste in the web browser nor can I paste on the rapidshare website because the paste option is not 'click-able'. I don't know what do to, please help.
    == This happened ==
    Every time Firefox opened
    == I just signed up to rapidshare and have the 'paste' option has never worked.

    Make sure that you do not block cookies.<br />
    See http://kb.mozillazine.org/Cookies
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • I have a Excel file which has lots of PDFs embed as a link.  When i converting to PDF the embed links are not working. Please help to slove this issue.

    I have a Excel file which has lots of PDFs embed as a link.  When i converting to PDF the embed links are not working. Please help to slove this issue.e

    I am also looking alternative way using inDesign to create the embed link as like as excel. is there any possible? Thanks for you reply

  • Why this candlestick Chart does not returns an URL as a link ?

    Hi,
    I have done a nice Candlestick Flash Chart. But The problem is that the link does not work. When I click on a point - the cross -, nothing happens, which means the URL is not displayed in the URL zone of the navigator - I am under Firefox. I have been using this technique on other charts (2D Column) and it was working nicely. I don't see why it is not working in the Candlestick type chart. I have been outputting the result of the PL/SQL into an item to check if the SLQ generated by the PL/SQL function was coorect and tested it under SQL Developper and I do get good results and nices URLS under SQL Developper. Thus is why i don't understand why this is not working here.
    DECLARE
    X VARCHAR2 (4000);
    BEGIN
    x := 'SELECT
    ''f?p=&APP_ID.:8:&SESSION.:GET_DETAIL_MONTH:NO::P8_MONTH:''
    ||TO_CHAR(TRUNC(DATE1, ''MM''), ''MM/YY'') LINK,
      TO_CHAR(TRUNC(DATE1, ''MM''), ''MM/YY'') LABEL,
      AVG(VALEUR) OPEN,
      MAX(VALEUR) HIGH,
      MIN(VALEUR) LOW,
      AVG(VALEUR) CLOSE FROM EVV_'|| UPPER (:p184_ename) ||
    ' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE = '''
    || UPPER (:p184_ename) ||
    ''') AND DATE1 BETWEEN TO_DATE (''01/01/'
    ||:P8_YEAR||'000000'', ''DD/MM/YYYYHH24MISS'') AND TO_DATE (''31/12/'
    ||:P8_YEAR||'235959'', ''DD/MM/YYYYHH24MISS'')
    GROUP BY TRUNC(DATE1, ''MM'')
    ORDER BY TRUNC(DATE1, ''MM'')';
    RETURN (X);
    END;Example of SQL generated by the above function :
    SELECT 'f?p=12400:8:1473118156348570:GET_DETAIL_MONTH:NO::P8_MONTH:'
    ||TO_CHAR(TRUNC(DATE1, 'MM'), 'MM/YY') LINK,
    TO_CHAR(TRUNC(DATE1, 'MM'), 'MM/YY') LABEL ,
    AVG(VALEUR) OPEN,
    MAX(VALEUR) HIGH,
    MIN(VALEUR) LOW,
    AVG(VALEUR) CLOSE
    FROM EVV_E007
    WHERE CLEF_VAR =
    (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE = 'E007'
    AND DATE1 BETWEEN TO_DATE ('01/01/2006000000', 'DD/MM/YYYYHH24MISS') AND TO_DATE ('31/12/2006235959', 'DD/MM/YYYYHH24MISS')
    GROUP BY TRUNC(DATE1, 'MM')
    ORDER BY TRUNC(DATE1, 'MM')
    Example of output of the link :
    f?p=12400:8:1473118156348570:GET_DETAIL_MONTH:NO::P8_MONTH:01/06     f?p=12400:8:1473118156348570:GET_DETAIL_MONTH:NO::P8_MONTH:02/06     
    Thank you for your kind answers !

    Hello Christian,
    I first thought that your url shouldn't contain / (in your month format - better to use a dash -).
    But then I remembered the Candlestick chart that is standard in APEX is having a bug.
    I did a quick test here: http://anychart.apex-evangelists.com/pls/apex/f?p=454:8:0::NO:::
    On the left you see the default chart in APEX (based on Anychart 3.3), if you click on the candle it doesn't show hello. If you click on the right chart it does.
    The right chart is based on Anychart 5 and makes use of our integration kit.
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    REWARDS: Please remember to mark helpful or correct posts on the forum

  • Ie 11 fails with 'IE Security detected that the URL and the configuration link to not match

    HI,
    I Have a user that is using IE 11 and is getting the following error:
    IE Security detected that the URL and the configuration link to not match. Please use the URL as configured.  Is and IP based URL. On IE 10 we get a similar message, but as soon as we add it to our trusted site and switch to compatibility
    mode the issue goes away.
    For example http://10.10.10.180/xxx/iafwebsite_810/
    What would be causing this issue?
    Any help would be appreciated.
    Thanks,
    Trish
    Trish Leppa

    Hi,
    It seems that this URL doesn't meet security level. Thus, as long as you add this URL to Trusted sites zone, this issue is fixed.
    Thanks!
    Andy Altmann
    TechNet Community Support

  • Regex for URL Validation

    HI I am validating a field which takes a url as input from the user.So the url may contain http,https,ftp links or the user may specify the ip address.So can anyone please help me out to create a suitable regex for that.I just need to check the validness of link and not that it exists or not.

    here i have changed the regex as suggested by you but
    it returns true even for http://com.com@
    which is invalid.
    So it did not worked :-(It did not work, because you did not use it correct:
    public class Foo {
        private static boolean isValidUrl(String url) {
            return url.matches("(https?|ftp)://www\\.\\w+\\.\\w+");
        public static void main(String[] args) {
            String[] urls = {
                    "http://com.com@",
                    "http://www.com.com",
                    "http://www.com.nl",
                    "http://www.com.co.uk",
                    "http://www.com"
            for(String url : urls) {
                System.out.println(url+" valid? "+isValidUrl(url));
    }

  • Is there a way to select MULTIPLE tabs and then copy ALL of the the URLs and titles/or URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; However, I prefer to use a Firefox feature rather than download an add on. Thanks.

    Currently, I can copy ONE tab's url and nothing else (not its name). Or I can bookmark all tabs that are open. However, I'd like to have the ability to select multiple tabs and then copy ALL of the the URLs AND their titles/or copy ALL of the URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; when I download the add on, I get a message saying that using the add on will disable Firefox's tab features. I prefer to use Firefox features rather than download and use an add on. Is there a way to do this without an add on?

    Hi LRagsdale517,
    You should definitely be able to upload multiple files by Shift-clicking or Ctrl-clicking the files you want to upload. Just to make sure you don't have an old version of the service cached, please clear the browser cache and then log in to https://cloud.acrobat.com/files. After clicking the File Upload icon in the upper-right corner, you should be able so select multiple files for upload.
    Please let us know how it goes.
    Best,
    Sara

  • How can I see the url of a link before clicking on it?

    Hi. I have Firefox 10.0.2. I used to be able to see the url of a link on web pages in the bottom left of the browser. That way, if I the url didn't seem legit I wouldn't click on the link. But now, when I put the mouse over a link, nothing comes up. How can I see the link addresses again? Thanks.

    The Status Bar. where the link previously showed on mouse hover, has been replaced by the Add-on Bar. You can install the following add-on to get some of the former Status Bar functions back. The Add-on Bar must be turned on. The add-on will also stop the showing of the "tooltip" type status loading text, and will, instead, show it in the Add-on Bar:
    *See --> https://support.mozilla.org/en-US/kb/what-happened-status-bar
    *To turn on the Add-on Bar, see --> https://support.mozilla.org/en-US/kb/Back%20and%20forward%20or%20other%20toolbar%20items%20are%20missing#w_showing-the-navigation-toolbar '''and click on "Add-on Bar" to check it'''
    *Add -on '''''Status-4-Evar''''': https://addons.mozilla.org/en-US/firefox/addon/status-4-evar/
    *If necessary, after install and restart:
    **Open Customze window (Firefox button > Options > Toolbar Layout '''''OR''''' View > Toolbars > Customize '''''OR''''' ALT+V+T+C '''''OR'''''right-click in the empty space at the end of the Tab Bar and choose Customize)
    **'''While Customize window is open''', drag any or all of the following from the Customize window to the Add-on Bar in the order and position you want them to appear. Then click "Done" button at lower right on the Customize window.
    ***"Status Text" ('''''link on mouse hover or during page loading''''' or "Done" when page is loaded)
    ***"Progress Meter" (progress bar of page loading)
    ***"Download Status" (status of download)
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.org/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.org/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.org/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *'''''Next Generation Java Plug-in for Mozilla browsers''''': [https://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • While Doing BW  Role Uploading Getting message "Linked Objects Not Found" ?

    Dear All,
    I am trying to upload a BW role from EP , while doing role upoad activity, when I am giving role name, system namein the first step it is identifying the role from the system.
    To that role four reports has been attached.
    After uploading the role, the role has been get uploaded, but the reports which are attached to the role it is showing that "Linked Objects Not Found", for all the reports.
    For all those reports I have checked the web url on BW server it is corect but then also I am getting above message.
    Please any one help me out in this scenario.
    Regards,
    Aditya

    The same problem during XI to BI integration as it was told in how-to.

  • ADF: OAF link is not working in other instance

    Hi,
    im using Jdev 11G.
    i have developed an ADF application which has 7 pages.
    one of the page has link to OAF page.
    when i click on the link its working fine in one instance when we moved to other instance its not working.
    when i click on OAF link from ADF page it shows me the below error:
    " You are trying to access a page that is no longer active.
    - You may have attempted to access to this page directly by bookmarking the page or copying the URL. This page does not support bookmarking.
    - The referring page may have come from a previous session. Please select Home to proceed. "
    Please help me to get out of this.
    Any suggestions will be really grateful.
    Thanks.

    Kumar wrote:
    Hi,
    im using Jdev 11G.
    i have developed an ADF application which has 7 pages.
    one of the page has link to OAF page.
    when i click on the link its working fine in one instance when we moved to other instance its not working.
    when i click on OAF link from ADF page it shows me the below error:
    " You are trying to access a page that is no longer active.
    - You may have attempted to access to this page directly by bookmarking the page or copying the URL. This page does not support bookmarking.
    - The referring page may have come from a previous session. Please select Home to proceed. "
    Please help me to get out of this.
    Any suggestions will be really grateful.
    It seems that your OAF linked page is requiring a session - or at minimum a user that is logged in. I'd check to see if your link is correct, then check to see if any single sign on operations are also working. (i.e. it doesn't appear that you are linking to a public page - or have an active session - on your second instance. If your user should be able to see the OAF page without logging in, I'd also check the EBS responsibilties that you have set up for that particular page access.)
    - Chad

  • AS: InDesign CS4: Missing links do not show path anymore?

    Hiya! Preparing to move to InDesign CS4, and opened a document where the links were missing. In CS2 with AS you could still get the old path to where the link was pointed to, but now if the link is missing AS returns "". ?? I can still get the file name, but that is fairly useless..
    I know the path is still retained somewhere, because the link pallet UI in InDesign shows path, and the path is there...
    Anyone have any ideas?
    >>
    id:25785,
    size:298164,
    asset URL:"",
    link xmp:link xmp of link id 25785 of image id 21318 of rectangle id 20575 of page id 20565 of spread id 6605 of document "AR09_1_006_006v4.indd" of application "Adobe InDesign CS4",
    asset ID:"",
    asset etag:"",
    edited:false,
    needed:true,
    link type:"JPEG",
    parent:image id 21318 of rectangle id 20575 of page id 20565 of spread id 6605 of document "AR09_1_006_006v4.indd" of application "Adobe InDesign CS4",
    file path:"", --in cs2, the path would still be here...
    index:1,
    name:"01_77509_TR_927.jpg",
    object reference:link id 25785 of image id 21318 of rectangle id 20575 of page id 20565 of spread id 6605 of document "AR09_1_006_006v4.indd" of application "Adobe InDesign CS4",
    label:"",
    editing state:editing unknown,
    version state:version unknown,
    date:date "Saturday, March 14, 2009 5:12:37 PM",
    status:link missing

    CS2:
    id:11759,
    size:260181,
    asset URL:"",
    link xmp:link xmp of link id 11759 of image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS2",
    asset ID:"",
    asset etag:"",
    edited:false,
    needed:true,
    link type:"JPEG",
    stock state:link is not stock,
    parent:image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS2",
    file path:"Graphics1:Cat Apparel:AR09_FallPrev:All Images:JPG SELECTS:3_12-3_13:77508:77508_DG_297.jpg",
    index:1,
    name:"77508_DG_297.jpg",
    object reference:link id 11759 of image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS2",
    label:"",
    editing state:editing nowhere,
    version state:no resource,
    date:date "Friday, March 13, 2009 5:16:21 PM",
    status:link missing
    CS4:
    id:12636,
    size:260181,
    asset URL:"",
    link xmp:link xmp of link id 12636 of image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS4",
    asset ID:"",
    asset etag:"",
    edited:false,
    needed:true,
    link type:"JPEG",
    parent:image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS4",
    file path:"",
    index:1,
    name:"77508_DG_297.jpg",
    object reference:link id 12636 of image id 11755 of rectangle id 9610 of page id 9604 of spread id 9593 of document "ack.indd" of application "Adobe InDesign CS4",
    label:"",
    editing state:editing unknown,
    version state:version unknown,
    date:date "Friday, March 13, 2009 5:16:21 PM",
    status:link missing
    So - to summarize....
    CS4: file path:"", status:link missing
    CS2: file path:"Graphics1:Cat Apparel:AR09_FallPrev:All Images:JPG SELECTS:3_12-3_13:77508:77508_DG_297.jpg", status:link missing
    Ack.....

  • In P6 P6 Help link is not working

    Hi,
    My P6 help link is not working in help menu.
    P6 Library and Support link are working.
    As suggested in another discussion i tried to update link in Admin>Application setting and restarted weblogic, But system is still taking some other link than i defined in application setting.
    Can anybody help?

    Hi,
    We worked on this issue ,
    Solution:
    In the P6 EPPM Admin application in the corresponding configuration, In P6 Help url we have modified the url from  http://hostname:8203/p6help/help to http://hostname:8203/p6help/ and we restarted the P6 server in weblogic console.
    Then everything fine now,
    Regards
    Kumar

  • Apple Mail links will not open in Firefox. The address bar and page are blank.

    I have just upgraded Firefox to version 4.0 and when I receive an email with a link in it, the link will not work. Firefox will load but the page is blank and the web address bar will sometimes show the link and sometimes not. If I cut and paste the address from the email it will not work.

    In mail.app preferences there is a setting for RSS that lets one choose which program is the default RSS reader. Whichever program is set to be the default RSS reader is used by mail.app to open any urls in mail messages.
    I really like my Mac but this is the most un-userfriendly, un-"it just works" thing I've run across in the 23 years I've been using Macintosh...

Maybe you are looking for