Regular Expression for Removing a space after the a... tag?

Hi there,
I'm fairly new to using Regular Expressions, but am in need of one that will help me find all <a...> tags that have a space immediately following that tag and replace it with the exact same tag, but no space following the <a...> tag.
So, for example, a regular expression that will find:
<a href="somelink.html"> Somelink</a>
as well as:
<a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('sub-nav_button_professional_portal','','images/sub-nav_button_ professional_portal_f2.png',1)"> Somelink</a>
And just remove the space appearing as part of the hyperlink.  Does anyone know how to accomplish this?

Thought of that, but it would remove spaces from crucial areas of my pages.  For example, conditional logic within a script, like:
for (i = 0; i > (a.length - 2); i += 3)
would become:
for (i = 0; i >(a.length - 2); i += 3)
While that wouldn't pose a huge problem, I'm messing up the syntax in order to fix something else, which is why I wanted to go the route of a regular expression.  I need to replace all "<a ...> " (space included) tags with "<a ...>" and make sure that the properties within the <a> tag stay in tact.

Similar Messages

  • Regular Expression for replacing Leading Spaces

    I don't claim to be any expert on Regular Expressions and even after reading CD's introduction to Reg Exp, I still can't figure out this one which I'm sure must be very basic.
    I want to replace all the leading spaces in a string with "." chrs. I could do this using the common replace/substr/instr functions, but I reckoned it would be possible in a single regular regexp_replace call.
    So far I've got this...
    SQL> select regexp_replace('      FRED BLOGS    WAS HERE    ', '^([:space:])*', '.')
      2  as result
      3  from dual;
    RESULT
    .      FRED BLOGS    WAS HERE
    SQL>Which is replacing the start of line with a "." and not the spaces.
    But I want my result to be:-
    RESULT
    ......FRED BLOGS    WAS HERE
    SQL>Cheers

    That was very good solution .
    Can you explain me the significance of "| " in the code, other things I could trace out.
    I try to run the code with the 2 cases
    when I give a space after | symbol it prints the * many times
    SQL> SELECT col1, REGEXP_REPLACE(col1, ' ([^ ]+.*)|','*\1')
    2 FROM (SELECT ' FRED BLOGS WAS HERE ' col1 FROM dual );
    COL1
    REGEXP_REPLACE(COL1,'([^]+.*)|','*\1')
    FRED BLOGS WAS HERE
    *FRED BLOGS    WAS HERE
    SQL> SELECT col1, REGEXP_REPLACE(col1, ' ([^ ]+.*)| ','*\1')
    2 FROM (SELECT ' FRED BLOGS WAS HERE ' col1 FROM dual );
    COL1
    REGEXP_REPLACE(COL1,'([^]+.*)|','*\1')
    FRED BLOGS WAS HERE
    ******FRED BLOGS WAS HERE

  • Need a regular expression for the text field

    Hi ,
    I need a regular expression for a text filed.
    if the value is alphanumeric then min 3 char shud be there
    and if the value is numeric then no limit of chars in that field.[0-9].
    Any help is appriciated...
    thanks
    bharathi.

    Try the following in the change event:
    r=/^[a-z]{1,3}$|^\d+$/i;
    if (!r.test(xfa.event.newText))
    xfa.event.change="";
    Kyle

  • Regular Expression To Remove Leading While Space

    Hii
    I have a data like this
    20200 Kuala Terengganu
    Terengganu
    Luala Terengganu
    I want to remove the Leading white space in the Second line .Can anybody help me to
    write regular expression for this?
    I want my result like the following :
    20200 Kuala Terengganu
    Terengganu
    Luala Terengganu
    Thanks In Advance
    Jim John

    But there's no difference between two group of lines which you posted. Could you please format your input and desired output with please?
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Wat should be the regular expression for string MT940_UB_*.txt to be used in SFTP sender channel in PI 7.31 ??

    Hi All,
    What should be the regular expression for string MT940_UB_*.txt and MT940_MB_*.txt to be used as filename inSFTP sender channel in PI 7.31 ??
    If any one has any idea on this please let me know.
    Thanks
    Neha

    Hi All,
    None of the file names suggested is working.
    I have tried using - MT940_MB_*\.txt , MT940_MB_*.*txt , MT940*.txt
    None of them is able to pick this filename - MT940_MB_20142204060823_1.txt
    Currently I am using generic regular expression which picks all .txt files. - ([^\s]+(\.(txt))$)
    Let me know ur suggestion on this.
    Thanks
    Neha Verma

  • How to form a regular expression for matching the xml tag?

    hi i wanted to find the and match the xml tag for that i required to write the regex.
    for exmple i have a string[] str={"<data>abc</data>"};
    i want this string has to be splitted like this <data>, abc and </data>. so that i can read the splitted string value.
    the above is for a small excercise but the tagname and value can be of combination of chars/digits/spl symbols like wise.
    so please help me to write the regular expression for the above requirement

    your suggestion is most appreciable if u can give the startup like how to do this. which parser is to be used and stuff like that

  • How to write the regular expression for Square brackets?

    Hi,
    I want regular expression for the [] ‘Square brackets’.
    I have tried to insert in the below code but the expression not validate the [] square brackets.
    If anyone knows please help me how to write the regular expression for ‘[]’ Square brackets.
    private static final Pattern DESC_PATTERN = Pattern.compile("({1}[a-zA-Z])" +"([a-zA-Z0-9\\s.,_():}{/&#-]+)$");Thanks
    Raghav

    Since square brackets are meta characters in regex they need to be escaped when they need to be used as regular characters so prefix them with \\ (the escape character).

  • What is the regular expression for the end of a story?

    Forgive me if this is wrong forum for asking this, but I'm trying to use the Find command using GREP and I need to know the regular expression for the end of a story. (Or, the last character of a story.) Thanks in advance.

    I'd try search for .\z (that's a dot in front) which ought to find the very last character in the story, and replace with $0 and your additional text.
    You know you can use a keyboard shortcut to move your cursor to the end of any story, right? Ctrl + End on Windows, Cmd + End, I think, on Mac. Unless you want to do this to every single story in the document, I would think you might be just as well off to put your text on the clipboard, put the cursor in the story and hit the key combo followed by Ctrl/Cmd + V to paste.

  • InCopy GREP: how can I search for a single space after a sentence?

    In the Find/Change box in InCopy, there's a preset GREP command: "Multiple Space to Single Space." In the books I'm working on, we need to do the opposite. I know I should learn regular expressions, and I'd like to, but frankly I'm pressed for time, so here's my question:
    What is the exact regular expression I should paste into the Find/Change box to find single spaces before sentences?
    Thanks!

    In Find, in the GREP area, you need to enter
    Find What: \. \S
    backslash-period = find a period
    tap the spacebar for a space ...there's a space after the period above
    backslash-cap S = not whitespace
    If you want to change it to two spaces after a period, group the Find expression so you can replace the Found text in the Change to field.
    Find What: (\. )(\S)
    Change To: $1 $2
    (I added a space after $1 so IC adds a second space after the period)
    AM

  • Regular expression for recognizing all tables in a sql statement

    Hi all
    I need a regular expression for recognizing all the tables bane in a geberic statement.
    Unlikely i need a regular expression that manage also inner join .I 'm sorry but this matter is new for me and i cannot find any usefull help in the web.
    Regards

    If you insist it should be something like:
    "SELECT ([A-Z0-9_]+)[.][A-Z0-9_]+(,([A-Z0-9_]+)[.][A-Z0-9_]+)* FROM (([A-Z0-9_]+)[.][A-Z0-9_]+) INNER JOIN (([A-Z0-9_]+)[.][A-Z0-9_]+) ON .+" plus spaces etc... Yes it's for this kind of statements only.
    But SQL parser is better because anyway you'll need to at least remove duplicates from founded names...

  • Regular expression to replace "emtpy space" ( ) bitween words with +

    Hallo!
    When I wish to find in code something like this:
    12144541 FirstWord SecondWord
    regular expression for that is:
    (\d{1,100})[\s-]\D{1,100}[\s-]\D{1,100}
    Now, please help me tu find regular expression to replace
    "emtpy space" ( ) bitween words with +
    12144541 FirstWord SecondWord to become
    12144541+FirstWord+SecondWord
    Thank you very, very, very much!

    A simple-minded solution is to use \s to match all
    whitespace; e.g. find \s and replace with +. DW CS3, at least, is
    smart enough to not replace end of line characters with the '+'
    character if you limit your search & replace to text.

  • Regular Expression for PathName???

    Anyone have a "ready to go" regular expression for detecting a pathname?
    for example I need to detect the following:
    myfile.txt
    ./myfile.txt
    ../my-file.ini
    /home/my-home/myFile.foo
    etc.
    Now, in a perfect world, it could also do Windows (or ANY OS for that matter) pathnames (though this is not terrbibly important for my case at least).
    TIA,
    /m

    import java.util.regex.*;
    * @author  Ian Schneider
    public class FileRegex {
        static Pattern pattern;
        /** Creates a new instance of FileRegex */
        public FileRegex() {
        public Pattern getPattern() {
            if (pattern == null) {
                pattern = Pattern.compile("([\\/]?(\\w+|\\.|\\.\\.)[\\/])*(\\w+)\\.?(\\w+)?");
            return pattern;
        public String[] parts(String path) {
            Matcher m = getPattern().matcher(path);
            if (m.find()) {
                return new String[] { m.group(1),m.group(3),m.group(4) };
            return null;
        public boolean matches(String path) {
            return getPattern().matcher(path).matches();
        public static final void main(String[] args) throws Exception {
            FileRegex regex = new FileRegex();
            String[] files = {
                "myfile.txt",
                "../myfile.txt",
                "./myfile.txt",
                "/a/b/c/myfile.txt",
                "/a/../myfile.txt",
                "myfile"
            for (int i = 0, ii = files.length; i < ii; i++) {
                System.out.println( files[i] + " match " + regex.matches(files));
    String[] pieces = regex.parts(files[i]);
    if (pieces != null)
    System.out.println(" path : " + pieces[0] + " file : " + pieces[1] + " ext : " + pieces[2]);
    I will leave it to you as an excercise to add support for spaces in path names, different separator characters, etc..

  • Create a list style with unique space after the last list item?

    I should start by saying that I'm a web designer and therefore extremely used to using CSS for type setting to the point that I now become frustrated when going back to the print world
    So here's what I'm trying to achieve:
    - I want to create a list style for bullet lists
    - I want there to be 3pt space after and space before paragraph breaks
    - I want there to be 9pt space after the entire list (or last list item)
    I can't for the life of me figure out how to do this short of overriding the space after amount on the last item each time I use my style.

    Hi supportneeder
    Welcome to the forum.
    Try this link:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=179&mforum=iworktips ntrick
    Pay attention to how +"styles work by example"+. Form up the list levels the way you want them and then select them to make the list style.
    Personally I can't help remarking on the obtuse behavior of programmers that they manufactured all the problems on the internet and only now, more than a decade later, patch together "solutions" they struggle to implement due to the legacy of all the awful standards we never needed to have in the first place.
    Peter
    btw The last list item is always a problem in typesetting. Usually you deal with it by having a particular style for that or the paragraph afte,r all of which can take multiple forms.

  • Why does my paragraph tag for images get repositioned AFTER the image?

    I have TCS2 and link my FM docs to RH.
    I use a paragraph tag in FM called "figure" for my imported images. I noticed there is too much space after the images in RH and discovered the "figure" tag is BELOW the images. So even if I map the tag to a RH style, it won't do any good. Any suggestions?

    This might fix your problem. Look at how your anchored frame appears in the FrameMaker document. It's probably like this:
    ┴ ¶
    Which is simply the anchored frame marker followed by the paragraph marker.
    Now try this. Before the anchored frame marker, add a forced space (CTRL-Space).
    |_| ┴  ¶
    When RoboHelp interprets this, it appears to place the paragraph before the anchored frame, not after it.
    This is assuming you've got the anchoring position set to"Below Current Line," as suggested earlier.
    Hope this helps!
    Jason

  • How to stop iphone 4s from putting a space after the second digit, when entering a text number from the keypad

    How do I stop the iphone 4s from putting a space after the second digit, when entering a text number from the keypad. Entering a text number on the key pad like 61998 comes out on the screen as 61 998 and the sms fails to go.

    The space (or lack thereof) should have no effect on whether or not the SMS goes through. The spacing is intended to make it easier for the human eye to comprehend the number. I'd start by resetting the network settings in General>Reset>Reset Network Settings.

Maybe you are looking for