Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ?
Example :
Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl"
Regex Match:
[PARAM1]
[PARAM2]
I Googeled it, found anything but that kind of extraction.
Thank-you very much for Any help !!
Steph. 5 2288
On Mar 9, 1:10 pm, "TheSteph" <TheSt...@NoSpa m.comwrote:
Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ?
Example :
Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl"
Regex Match:
[PARAM1]
[PARAM2]
I Googeled it, found anything but that kind of extraction.
Thank-you very much for Any help !!
Steph.
try this
\[\w*\]*
-
shashank kadge
shashank kadge wrote:
On Mar 9, 1:10 pm, "TheSteph" <TheSt...@NoSpa m.comwrote:
>Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ?
Example :
Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl"
Regex Match:
[PARAM1]
[PARAM2]
I Googeled it, found anything but that kind of extraction.
Thank-you very much for Any help !!
Steph.
try this
\[\w*\]*
-
shashank kadge
Or rather:
\[\w*\]
The extra asterisk after the bracket would make it match not only
"[anything]" but also "[anything" and "[anything]]]]]]]".
--
Göran Andersson
_____ http://www.guffa.com
On Mar 9, 2:03 pm, Göran Andersson <g...@guffa.com wrote:
shashank kadge wrote:
On Mar 9, 1:10 pm, "TheSteph" <TheSt...@NoSpa m.comwrote:
Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ?
Example :
Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl"
Regex Match:
[PARAM1]
[PARAM2]
I Googeled it, found anything but that kind of extraction.
Thank-you very much for Any help !!
Steph.
try this
\[\w*\]*
-
shashank kadge
Or rather:
\[\w*\]
The extra asterisk after the bracket would make it match not only
"[anything]" but also "[anything" and "[anything]]]]]]]".
--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -
- Show quoted text -
Correct Goran.
-
shashank kadge
I did my homework this week-end...
I found a solution to my problem, Here it is
RegexExpression : \[[^\]|^\[]*\]
From : [111]qf fds fdsf[P-TE ST-1]dsqfdsq[123123]fdsfd sq()[]fdsqf+12589 f
fd fdsf [P-TEST-2] f fdsf dsf df[]dsfdsq[P-TEST-3]fdsqf df[[456]]
I get :
[111]
[P-TE ST-1]
[123123]
[]
[P-TEST-2]
[]
[P-TEST-3]
[456]
"TheSteph" <Th******@NoSpa m.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ?
Example :
Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl"
Regex Match:
[PARAM1]
[PARAM2]
I Googeled it, found anything but that kind of extraction.
Thank-you very much for Any help !!
Steph.
I am not sure it does exactly what you want. It exclude the vertical bar and
the caret from allowed character between square bracket. The alternation
character is a simple normal character in a list between square bracket and
then the caret should not be repeated for exclusion. Also it follows you
don't have to quote special regex characters between square bracket.
I think you meant \[^][]*\]
/LM
"TheSteph" <Th******@NoSpa m.comwrote in message
news:Oy******** ******@TK2MSFTN GP04.phx.gbl...
>I did my homework this week-end...
I found a solution to my problem, Here it is
RegexExpression : \[[^\]|^\[]*\]
From : [111]qf fds fdsf[P-TE ST-1]dsqfdsq[123123]fdsfd sq()[]fdsqf+12589
f
fd fdsf [P-TEST-2] f fdsf dsf df[]dsfdsq[P-TEST-3]fdsqf df[[456]]
I get :
[111]
[P-TE ST-1]
[123123]
[]
[P-TEST-2]
[]
[P-TEST-3]
[456]
"TheSteph" <Th******@NoSpa m.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>Hi,
I'm new to Regex..
Could someone show me how I can extract substring enclosed in [] ? Example : Source String :
"hjklhjlhjl [PARAM1] hjhlhjl [PARAM2] jsqdhjldhl" Regex Match:
[PARAM1]
[PARAM2] I Googeled it, found anything but that kind of extraction. Thank-you very much for Any help !!
Steph.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: G. Stewart |
last post by:
The objective is to extract the first n characters of text from an
HTML block. I wish to preserve all HTML (links, formatting etc.), and
at the same time, extend the size of the block to ensure that all
closing tags are recovered.
For example, simply extracting the first 400 characters of a HTML
block may result in an <i> opening tag being...
|
by: alphatan |
last post by:
Is there relative source or document for this purpose?
I've searched the index of "Mastering Regular Expression", but cannot
get the useful information for C.
Thanks in advanced.
--
Learning is to improve, but not to prove.
|
by: H |
last post by:
This is kind of an followup on oneof my previous questions, and it has with
RegEx to do.
I have a string containing of several words. What would a good regex
expression looklike to get one match on every word ?
For example :
String myString =" This is the string that stupid H can't split up";
// A good RegEx needed here .. So the result...
|
by: D |
last post by:
My first attempt at this and I'm searching formulas like so
RIGHT(TEXT(A15,'yy'),1)*1000+A15-CONCATENATE(1,'-','jan','-',TEXT(A15,'yy'))+1
I want to extract the row / col coordinates (A15 in above)
so I'm using this +\d+\d*
however I want unique ones and not 3 copies of A15 as the above returns.
|
by: steve |
last post by:
here's the deal...cvs, tick encapsulted data. trying to use regex's to
validate records. here's an example row:
'AD,'BF','132465','06/09/2004','','BNSF','A','TYPE','1278','','BR','2999',''
,'LX','','01','09','1','','','','','','','','','CUSTOM JOB CODE TEST'
record type is in the 8th column ('1278'). using regex b/c there are a
miriad of...
| |
by: Ya Ya |
last post by:
Hi,
I have a string with some fixed text and variable text.
For example: "this is a fixed text THE NEEDED INFO more more fixed text".
How do I get the the variable text (THE NEEDED INFO) from this string ?
A simple example will help.
Thanks.
ra294@hotmail.com
|
by: lgbjr |
last post by:
Hello All,
I have the following type of string: "X:Y\Z.exe" "123"
What I need is an array of strings with the information from within each set
of quotes. I was trying to use a Regex.Split, but I can't figure out how to
escape a quote. The closest I got was Regex.split(String,"(\"")"), which
gives me an array of strings:
"X:Y\Z.exe
|
by: |
last post by:
I'm analyzing large strings and finding matches using the Regex class. I
want to find the context those matches are found in and to display excerpts
of that context, just as a search engine might. In terms of code, what's the
easiest way to make that happen? The code below works fine for identifying
the matches, but it doesn't try to extract...
|
by: Flomo Togba Kwele |
last post by:
I am having difficulty writing a Regex constructor.
A line has a quote(") at its beginning and its end. I need to strip both characters off. If the
line looks like "1", I need the result to be 1.
If it were sed, I could just do s/^"// and s/"$//, but I'm confused with the quote escape
characters. Also, can I do both replacements at once?
...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |