Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. String Replacement in 'HTML 5 FireFox'

String Replacement in 'HTML 5 FireFox'

Scheduled Pinned Locked Moved Regular Expressions
htmlregexhelp
15 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13540679
    wrote on last edited by
    #1

    Hello Community, I have created Regex with Regex Magic with HTML 5 Firework, see attached. The Regex [A-Za-z]{3}\d{4} successfully finds a string such as GMK6954 using Character Spaces. Can someone help with modifying the Regex such that it replaces the first 3 letters with --- so the resulting Regex will generate the following 6954 Thanks

    OriginalGriffO 1 Reply Last reply
    0
    • U User 13540679

      Hello Community, I have created Regex with Regex Magic with HTML 5 Firework, see attached. The Regex [A-Za-z]{3}\d{4} successfully finds a string such as GMK6954 using Character Spaces. Can someone help with modifying the Regex such that it replaces the first 3 letters with --- so the resulting Regex will generate the following 6954 Thanks

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Change you digits to a "excluded suffix" and use String.prototype.replace() - JavaScript | MDN[^]:

      [A-Za-z]{3}(?=\d{4})

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      U 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Change you digits to a "excluded suffix" and use String.prototype.replace() - JavaScript | MDN[^]:

        [A-Za-z]{3}(?=\d{4})

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

        U Offline
        U Offline
        User 13540679
        wrote on last edited by
        #3

        Hi Griff, Thanks for reaching out. Unfortunately, it didn't work. The replacement just returns [A-Za-z]{3}(?=\d{4})

        OriginalGriffO 1 Reply Last reply
        0
        • U User 13540679

          Hi Griff, Thanks for reaching out. Unfortunately, it didn't work. The replacement just returns [A-Za-z]{3}(?=\d{4})

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          And how - exactly - did you try it?

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          U 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            And how - exactly - did you try it?

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            U Offline
            U Offline
            User 13540679
            wrote on last edited by
            #5

            Is it possible to send an attachment on this forum I would like to send a screenshot to you.

            OriginalGriffO 1 Reply Last reply
            0
            • U User 13540679

              Is it possible to send an attachment on this forum I would like to send a screenshot to you.

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #6

              No. Copy'n'paste the relevant code fragments.

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              U 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                No. Copy'n'paste the relevant code fragments.

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                U Offline
                U Offline
                User 13540679
                wrote on last edited by
                #7

                Hi, sorry for the delayed response. I wanted to show you a screenshot, because I'm not getting an error from the application I'm using. It's replacing the string with [A-Za-z]{3}(?=\d{4}) Let me know if you can see the screenshot from the link below? regmagic2.png - Google Drive[^]

                OriginalGriffO 1 Reply Last reply
                0
                • U User 13540679

                  Hi, sorry for the delayed response. I wanted to show you a screenshot, because I'm not getting an error from the application I'm using. It's replacing the string with [A-Za-z]{3}(?=\d{4}) Let me know if you can see the screenshot from the link below? regmagic2.png - Google Drive[^]

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #8

                  And what do you think that tells me about how you coded it? To quote myself:

                  Quote:

                  And how - exactly - did you try it?

                  If you go for a drive and break down, when you call the garage, do you send them a picture of the view you can see out the car window? Or tell them what happened and where you are?

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  U 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    And what do you think that tells me about how you coded it? To quote myself:

                    Quote:

                    And how - exactly - did you try it?

                    If you go for a drive and break down, when you call the garage, do you send them a picture of the view you can see out the car window? Or tell them what happened and where you are?

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                    U Offline
                    U Offline
                    User 13540679
                    wrote on last edited by
                    #9

                    I dont understand. Did you see the screenshot? I simply cut-and-paste your regex I should point out the regex I originally sent was not generated by me - I simply got the regex using an application called RegexMagic. I am 100% new to Regex. This means, I really don't have a clue what you're referring to. Please help

                    OriginalGriffO D 2 Replies Last reply
                    0
                    • U User 13540679

                      I dont understand. Did you see the screenshot? I simply cut-and-paste your regex I should point out the regex I originally sent was not generated by me - I simply got the regex using an application called RegexMagic. I am 100% new to Regex. This means, I really don't have a clue what you're referring to. Please help

                      OriginalGriffO Offline
                      OriginalGriffO Offline
                      OriginalGriff
                      wrote on last edited by
                      #10

                      Code. A regex doesn't exist in isolation - it has to be used in code in order to do anything. On it's own, it's just a string ...

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                      1 Reply Last reply
                      0
                      • U User 13540679

                        I dont understand. Did you see the screenshot? I simply cut-and-paste your regex I should point out the regex I originally sent was not generated by me - I simply got the regex using an application called RegexMagic. I am 100% new to Regex. This means, I really don't have a clue what you're referring to. Please help

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #11

                        :wtf: What does it take to get you to copy and paste the code you're using where you're setting up and using this RegEx?

                        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                        Dave Kreskowiak

                        U 1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          :wtf: What does it take to get you to copy and paste the code you're using where you're setting up and using this RegEx?

                          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                          Dave Kreskowiak

                          U Offline
                          U Offline
                          User 13540679
                          wrote on last edited by
                          #12

                          Hi Dave, Sorry for the delayed response The reason for wanting to show a screenshot is because I use application to insert the a Search and Replace regex. So I would enter [A-Za-z]{3}\d{4} in the Search dialogue box, and [A-Za-z]{3}(?=\d{4}) in the replace dialoge box. The search regex works fine, but the replace regex returns [A-Za-z]{3}(?=\d{4}) I'm assuming the the Regex pattern HTML 5 FireFox doesn't allow for replace?

                          D 1 Reply Last reply
                          0
                          • U User 13540679

                            Hi Dave, Sorry for the delayed response The reason for wanting to show a screenshot is because I use application to insert the a Search and Replace regex. So I would enter [A-Za-z]{3}\d{4} in the Search dialogue box, and [A-Za-z]{3}(?=\d{4}) in the replace dialoge box. The search regex works fine, but the replace regex returns [A-Za-z]{3}(?=\d{4}) I'm assuming the the Regex pattern HTML 5 FireFox doesn't allow for replace?

                            D Offline
                            D Offline
                            Dave Kreskowiak
                            wrote on last edited by
                            #13

                            You're making a lot of baseless assumptions and STILL not providing what is needed to solve the problem.

                            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                            Dave Kreskowiak

                            U 1 Reply Last reply
                            0
                            • D Dave Kreskowiak

                              You're making a lot of baseless assumptions and STILL not providing what is needed to solve the problem.

                              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                              Dave Kreskowiak

                              U Offline
                              U Offline
                              User 13540679
                              wrote on last edited by
                              #14

                              Dave, I'm not sure I could be any clearer. If you looked at the image you would see exactly what happens when I insert the Regex

                              D 1 Reply Last reply
                              0
                              • U User 13540679

                                Dave, I'm not sure I could be any clearer. If you looked at the image you would see exactly what happens when I insert the Regex

                                D Offline
                                D Offline
                                Dave Kreskowiak
                                wrote on last edited by
                                #15

                                Never heard of DataCleaner. Don't use it and not going to start. If it's some tool you found somewhere, your best source of support is going to be whoever wrote it. Your BIGGEST mistake was never telling anyone you were using some tool to do this work instead of writing your own code to do it.

                                Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                                Dave Kreskowiak

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups