CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Removing (R)

 



ab52
New User

Oct 14, 2015, 10:52 AM

Post #1 of 2 (7430 views)
Removing (R) Can't Post

Hi All

Am failing on a regex to match


Quote
Intel(R) Xeon(R) CPU X5570 @ 2.93GHz

i am trying to just get


Quote
Intel Xeon X5570

I have tried a few and not got anywhere


Code
s/\(.+\)//gi


Would love a hand at this

Thanks


Laurent_R
Veteran / Moderator

Oct 15, 2015, 8:30 AM

Post #2 of 2 (7398 views)
Re: [ab52] Removing (R) [In reply to] Can't Post

Just removing (R) works for me, as shown in this session under the Perl debugger;

Code
  DB<1> $_ = "Intel(R) Xeon(R) CPU X5570 @ 2.93GHz" 

DB<2> s/\(.+\)//gi;

DB<3> print $_
Intel CPU X5570 @ 2.93GHz
DB<4>

If it does not work for you, please show your code.

If "Intel(R) Xeon(R) CPU X5570 @ 2.93GHz" is in a variable called $line, then you should have:

Code
$line =~ s/\(.+\)//gi;

If you need something else, please specify.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives