Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:43:49+00:00 2026-06-11T21:43:49+00:00

I am modifying a file to conform to new standards. I only learnt RegEx

  • 0

I am modifying a file to conform to new standards.
I only learnt RegEx for a week many years ago but never got to use it extensively. Therefore I’m seeking a quick solution here. Any one care to help?

–Updates–
Thanks for all your reply, here are more details to the question:
The following is a snapshot of the file

"Qty"   "Reference" "Part Name" "PCB DECAL" "Manufacturer"  "Description"   "Value"  
"4" "C37 C67-68"    "2.2UF/10V" "C0805" ""  "Capacitor" "2.2UF/10V"  
"2" "CPL1-2"    "CPL"   "CPL-250-200-NOVIA" "Anaren"    ""  "1P510"    
"15"    "M1-15" "HOLE100"   "HOLE100_180"   ""  ""  ""  
"4" "L1-2 L5 L7"    "IND"   "L0603" ""  "MOLDED INDUCTOR, 0.5" PIN SPACING" "2.2nH"  
"9" "R2 R8 R12 R34-35"  "R" "R0603" ""  ""  "0"  

Basically I need to detect all “-” in column 2 that are followed by a number and insert in between the letters that are at the beginning of the word.

Regarding the language, I was actually using Notepad++, thinking the same expressions could at leased by ported to other platforms such as SED if it comes to that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:43:50+00:00Added an answer on June 11, 2026 at 9:43 pm
    ([A-Za-z]){1,}([0-9]{1,})-([0-9]{1,})
    

    The regex matches:

    • The characters A to Z, a to z one or more times (first capture), followed by
    • The characters 0 to 9 one or more times (second capture), followed by
    • The character -, followed by
    • The characters 0 to 9 one or more times (third capture)

    Replacement pattern is something like this:

    $1$2-$1$3
    

    Example in PHP preg:

    $output = preg_replace('/([A-Za-z]){1,}([0-9]{1,})-([0-9]{1,})/', '$1$2-$1$3', $input);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I 'm new about android.I need ContentResolver instance when modifying PhoneWindowManager file.but the PhoneWindowManager
I'm now modifying the gcc's md file, for a mips(el) target. gcc src's version
Modifying CKEditor 3.6.2 is not easy, but I tried hard . One problem that
Modifying a SnapPages theme, meaning I only have access to the CSS stylesheet. I
I have a problem with modifying xml file when i first load and then
I have to write a program using this exact .h file not modifying anything.
Modifying the hosts file requires a mac app to ask for the user's admin
After modifying my hosts file I have appended the location for testunc to 127.0.0.1.
I would like to know what would be the impact of modifying web.config file
When modifying a file, is it always necessary to rewrite the entire file or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.