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 6896377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:01:59+00:00 2026-05-27T07:01:59+00:00

I have a string: Blah blah blah blah blah blah, and I need to

  • 0

I have a string: “Blah blah blah “blah” blah blah”, and I need to replace quotes on this string to «Blah blah blah «blah» blah blah»

I was trying to use this script:

$m=preg_replace('/([^\s>])\\\"/s',"$1»",$m);
$m=preg_replace('/\\\"([^\s])/s',"«$1",$m);

But when the string beginning from the space, i have something like that:

 »Some text» Some text Some text

How can I do this?

  • 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-27T07:01:59+00:00Added an answer on May 27, 2026 at 7:01 am

    The most direct approach might be to use lookarounds to detect it the quote is directly before a word or directly after.

    $m = preg_replace('/"(?=\w)/', '«', $m);
    $m = preg_replace('/(?<=\w)"/', '»', $m);
    

    This will work well on your example, but may be too simplistic. You might want to go further and look for a word charactor or punctuation so “blah blah.” will match as well. That would make the second example something like this: /(?<=[\w,.?!\)])"/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that looks like this: blah blah blah yada yada http://www.example.com/check?x=rabP4F3Mk&dept=check
I have a string like this: blah blah blah_0123 So basically i need a
I have this string: \Blah \'Blah\' Blah\ . There is another string inside it.
I have string as abvd.qweqw.sdfs.a=aqwrwewrwerrew . I need to parse this string and get
I currently have the string: Blah, blah, blah,~Part One, Part Two~,blah blah I need
I'm trying to figure out how to replace some text in this string: 'some
I have a String that looks like this: Blah blah one.<tmp>[[url=b, link=c]]</tmp> Blah blah
I have a string that looks like: http://www.example.com/index.do/blah/1_44/asdf/asdf/asdf http://www.example.com/index.do/blah/1_44_2342/asdf/asdf/asdf I need to grab the
I have a string [something]text1[/something] blah blah [something]text2[/something] I need to write a Perl
Ok, so I have a string like so: index.php?page=test2;sa=blah And I need only to

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.