473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Regax Prob

Hello Everyone,
here i am posting regex prob. can anybody tell me why is not working. i want replace NVRAM 0x0000C000 to 0x0000FEFF; string with space string.

Expand|Select|Wrap|Line Numbers
  1. ..
  2.  
  3. $str="NVRAM 0x0000C000 to 0x0000FEFF;asdweqrc";
  4. $str =~ s/[NVRAM]\s+0[xX][0-9a-fA-F]\s+[to]\s+0[xX][0-9a-fA-F]//g;
  5. printf("str=$str");
  6.  
  7.  
output should be only this string == asdweqrc
Nov 16 '07 #1
1 1227
Hello Everyone,
here i am posting regax prob. can anybody tell me why is not working. i want replace NVRAM 0x0000C000 to 0x0000FEFF; string with space string.

Expand|Select|Wrap|Line Numbers
  1. ..
  2.  
  3. $str="NVRAM 0x0000C000 to 0x0000FEFF;asdweqrc";
  4. $str =~ s/[NVRAM]\s+0[xX][0-9a-fA-F]\s+[to]\s+0[xX][0-9a-fA-F]//g;
  5. printf("str=$str");
  6.  
  7.  
output should be only this string == asdweqrc
You can achieve the result in 2 ways:

1) using split function as

Expand|Select|Wrap|Line Numbers
  1. my $str="NVRAM 0x0000C000 to 0x0000FEFF;asdweqrc";
  2. my @strings = split(/;/,$str);
  3. print "result = $strings[1]";
  4.  
2) using the regex as you have asked

Expand|Select|Wrap|Line Numbers
  1. my $str="NVRAM 0x0000C000 to 0x0000FEFF;asdweqrc";
  2. $str =~ s/(.*);(\w+)/$2/gi;
  3. print "result = $str";
  4.  
Nov 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: josephrthomas | last post by:
hi..i am trying to make a login page and i am using access table.. when the user enters his userid and password i want to check the password from the table.. if any user with the userID that is...
29
by: Thomas | last post by:
Hi I have an XSL stylesheet: <xsl:for-each select="TRACKS/TRACK"> <tr class="TDL"> <td width="90%"><xsl:number value="position()" format="1" /> - <xsl:value-of select="TRACKTITLE"/></td>...
5
by: David Sobey | last post by:
Hi Sorry bout this basic prob. Got a file called file.obj. tryna read the first line from it as a string and print it to the screen. getting errors: #include "stdafx.h" #include <stdio.h>...
2
by: Dishan Fernando | last post by:
Hi my prob is like this.. ----------------------------- create table ax( i int , j int ) create table ay( i int ,
15
by: Raj | last post by:
Hello all: We have a table with about 2400 cells. Our requirement is to highlight the cells in the table whose data has changed, every 5 seconds. Our script behaves relatively ok in Firefox, but...
6
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
2
by: Wilhelm Kutting | last post by:
hi, i like to solve a code-prob: tidy is bitching about <...> proprietary attribute "type" <...> lacks "action" attribute how can i make this nice? this is my code
28
by: Vishal Naidu | last post by:
i m new to the C world... i ve been told by my instructors not to use goto stmt.. but no one could give me a satisfactory answer as to why it is so.. plz help me out of this dilemma, coz i use...
0
Savage
by: Savage | last post by:
I'm making for fun a simple program which format a input file.Input file sustain of person name,lastname and date of birth.Output file si supposed to be forammted as following: NAME ...
2
by: mnacw | last post by:
Can anybody help me to resolve this prob. i have installed Visual Studio 2005 Professional edition. I am working in VB.Net. When I tried to connect to database it is connected but when i make some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.