Hi,
This is not SQL Server database problem, however, net search has failed
to generate a solution to the problem, I'm trying my luck at this NG
now.
Problem, remove the special character, [ from text.
e.g. text =
"this is [1] and [stuff] and some [2] and hat [3] and dog"
Desired result =
"this is 1 and [stuff] and some 2 and hat 3 and dog"
I know [[:digit:]] would find all the instances of digits inside
brackets such as [1], [2], [3]. However, I don't know how to get rid
of the special characters of [ and ].
Any regular expression expert out there?
Thanks.
Don 8 1727
NickName (da****@rock.com) writes: This is not SQL Server database problem, however, net search has failed to generate a solution to the problem, I'm trying my luck at this NG now.
Problem, remove the special character, [ from text. e.g. text = "this is [1] and [stuff] and some [2] and hat [3] and dog"
Desired result = "this is 1 and [stuff] and some 2 and hat 3 and dog"
I know [[:digit:]] would find all the instances of digits inside brackets such as [1], [2], [3]. However, I don't know how to get rid of the special characters of [ and ].
Any regular expression expert out there?
Since you did not specify which regular expressions you are using, I'm
taking the liberty to answer with the regexps I know, that is those of
Perl. In Perl you would say:
s/\[([0-9]+)\]/\1/g
The \[ means [, that is \ is an escape charactter. () is for grouping,
and \1 refers back to this paren.
I have only seen glimpses of the regexps in .Net, but it appears to be
similar to Perl. There might be different rules for when you need \
though. In Textpad that I use, I would have to say \( and \)to use parens
for grouping.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
> Problem, remove the special character, [ from text. e.g. text = "this is [1] and [stuff] and some [2] and hat [3] and dog"
Desired result = "this is 1 and [stuff] and some 2 and hat 3 and dog"
Using the Zeus editor: http://www.zeusedit.com
These are the search and replace regular expresions:
Search: (\[)([0-9]+)(\])
Replace: \2
Note: Zeus is shareware (45 day trial).
Jussi Jumppanen
Author: Zeus for Windows
Erland,
I appreciate your response, unfortunately I'm not using Perl.
Don
Jussi,
Thanks for the response, I think your tool seems clever, and yet I'm
trying not to introduce many tools within one project.
Don.
NickName (da****@rock.com) writes: I appreciate your response, unfortunately I'm not using Perl.
If in you insist on not telling what you use, the responses may not always
be applicable.
Anyway, I hoped that you would be able to translate the Perl stuff to
whatever you are using.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
NickName wrote: Thanks for the response, I think your tool seems clever, and yet I'm trying not to introduce many tools within one project.
The good thing is the regexp's that I posted are just standard
unix style regexp's so they should work with any tool that can
handle these type of regexp's.
Jussi Jumppanen
Author: Zeus for Windows http://www.zeusedit.com
Shoot, you're tricky, now that you say it's sort of generic, I tried it
and it works nice, thanks.
Erland,
Jussi's solution solved the problem. You seem a very kind person, if
one day I travel to Sweden and you're available, I would love to buy
you a beer.
Kind regards,
Don Li This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Westcoast Sheri |
last post by:
What is the most efficient way of extracting the first two digits in a
string?
The following is wrong for me, because it only gives me the first
instance of two digits together:
$string =...
|
by: Shreyas Kulkarni |
last post by:
hi there,
recently i have got a problem regarding calculation of sum of digits in
a floating point or precision number. the weird behaviour of
compiler/language is preventing me from calculating...
|
by: Kosio |
last post by:
Hello,
I know of a way to extract digits from a number using the %10 and
divide by 10. But I am wondering if there is an algorithm out there
that does not use a divide by 10 feature.
The...
|
by: Luke Wu |
last post by:
Is there a C function that returns the number of digits in an input
int/long?
example:
numdigits(123) returns 3
numdigits(1232132) returns 7
|
by: Kuljit |
last post by:
I am doing Engineering(B.Tech) in Computer Science.
I have a question for which i am struggling to write a C code(program).
It struck me when we were being taught about a program which counts the...
|
by: Anoop |
last post by:
Hi All
I am getting two different outputs when i do an operation using
string.digits and test.isdigit(). Is there any difference between the
two. I have given the sample program and the output
...
|
by: jmcgill |
last post by:
Hello.
Is there a method for computing the number of digits, in a given numeric
base, of N factorial, without actually computing the factorial?
For example, 8! has 5 digits in base 10; 10! has...
|
by: Ulrich Dorda |
last post by:
I need a pytho nscript to read numbers(with loads of digits) from a
file, do some basic math on it and write the result out to another file.
My problem: I don't get python to use more digits:
...
|
by: ocean |
last post by:
Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.
For example, it should output the individual digits...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
| |