[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to match this

Posted on 2002-03-03
5
Medium Priority
?
149 Views
Last Modified: 2013-12-25
I need to match "[/ADDRESS]" using the following
$new_post =~ s/\[/ADDRESS\]/NEW/g;

the problem I have is how to get the first / to work thats part of the "[/ADDRESS]" string
0
Comment
Question by:kplonk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 6838258
kplonk,

"..how to get the first / to work thats part of the "[/ADDRESS]" string ..."

Can you explain, in plain english, what exactly you are trying to do?

It is best not to post any code, as it not only confuses things, but also flys in the face of providing you a working solution fast.

Let me know.
0
 
LVL 84

Accepted Solution

by:
ozo earned 80 total points
ID: 6838498
$new_post =~ s/\[\/ADDRESS\]/NEW/g;
#or
$new_post =~ s{\Q[/ADDRESS]}{NEW}g;
0
 
LVL 3

Expert Comment

by:Tsvetomir
ID: 6838555
ozo  gave you the good answer  [ and / are  special chars you need to escape them - to do this you have to add \ before the special char ie : \[ \/

(\Q treats all special chars as normal untill it it meets \E)

:)))
0
 

Author Comment

by:kplonk
ID: 6839222
Thats the way to do it, the odd things is that i had tried it but it did not work, must have been tired.
0
 
LVL 84

Expert Comment

by:ozo
ID: 6840160
#or
$new_post =~ s!\[/ADDRESS]!NEW!g;
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question