Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How do I replace characters in the middle of a string?

    General Discussion
    replace middleofstrin
    1
    2
    428
    Loading More Posts
    • 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.
    • Adam Yik
      Adam Yik last edited by

      How do I replace a character/a group of characters in each line? For example:
      https://www.example.com/images/asdfuisdhfaskehtiohgs_50.png
      https://www.example.com/images/sdfjksaldfjalsjdkdddd_20.jpg
      https://www.example.com/images/shgrfjkcviofreavcdfsd_600.jpg
      https://www.example.com/images/disolkhrewiousdfuoidd_400.png

      I want it replace it with:
      https://www.example.com/images/asdfuisdhfaskehtiohgs_1280.png
      https://www.example.com/images/sdfjksaldfjalsjdkdddd_1280.jpg
      https://www.example.com/images/shgrfjkcviofreavcdfsd_1280.jpg
      https://www.example.com/images/disolkhrewiousdfuoidd_1280.png

      I want to replace any amount of digits without replacing “_” and anything before it and I do not want to overwrite anything after the dot “.”. I want to replace something in between it (the numbers).

      And I do not know how to use the regular expressions for replacing something that is next to a character I do not want to replace.

      1 Reply Last reply Reply Quote 0
      • Adam Yik
        Adam Yik last edited by Adam Yik

        Solved, realized how the brackets work, the solution is this: [_].*?[.]. Sorry!

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors