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

  • Home
  • SEARCH
  • 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 1081041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:06:57+00:00 2026-05-16T22:06:57+00:00

If I have a string like this: word1 ‘word2’ word3 is it possible to

  • 0

If I have a string like this:

“word1 ‘word2’ word3”

is it possible to use a regex replace to change the string to this:

“word1 word3 ‘word2′”

I know what word1 and word3 will be, but do not know what word2 will be, but it will always be in single quotes.

  • 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-05-16T22:06:58+00:00Added an answer on May 16, 2026 at 10:06 pm

    You can replace "word1 ('\w+') word3" with "word1 word3 \1". The replace syntax might be different in other regex engines; I’m using .NET’s which is based on Perl’s.

    • \w+ matches a series of word characters, aka a word. You can change this if it does not fit your definition of word;
    • The parenthesis are used to delimit groups within the expression. The first is group one, the second is group two, etc. Usually regex engines count group zero as the entire match;
    • The \1 in the replace string means to use group one from the match, \2 means group two, etc.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have output like this: Word1 Word2 Word3 Word4 Where the number of
I have an xml that looks like this <words> <word>word1</word> <word>word2</word> <word>word3</word> <word>word4</word> </words>
I'm having a hard time understanding this regex stuff... I have a string like
I have the string like this: String s = word=PS1,p1,p2,p3=q1,q2|word2=PS3,p4,p5,p6=q3; or like this: String
Suppose I have a string like this: abc%\%%%% I want to replace multiple %%%
I have a regex to find if string have like this -> #3232 substring.
I have string like this /c SomeText\MoreText Some Text\More Text\Lol SomeText I want to
I have string like this: G:\Projects\TestApp\TestWeb\Files\Upload\file.jpg How can I remove all text before Files
I have string looking like this: 'Toy Story..(II) (1995)' I want to split the
I have a string like this that I need to parse into a 2D

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.