|
I use Regex match to find multiple words in Like mode (start and end point). I do not want the return to include the space as the first position and I do not want the final space to count as valid.
Regular Expression: "\b(?:.Road.|.ous.|.Street.)\b" Must Return: Match:9 length:5 End:13
Text: "have one house free."
|
|
|
|
|
Hello there, I have a string that looks like this
\abc\rvr\sad\dqwdwq Some text \rfdqwdvr\rtgevr\rgwvrr\23rvrv Some text \rffewvr\rfewvr\rvfewrr\rvrwefewv
I want to match the parts of the string that are connected by the backslashes. I partially achieved this with
[\\][A-z0-9]+ but this only matches the first one. How can I match every part with backslashes in this string?
Thanks
modified 31-Aug-21 8:08am.
|
|
|
|
|
Assuming you want to extract three strings:
- \abc\rvr\sad\dqwdwq
- \rfdqwdvr\rtgevr\rgwvrr\23rvrv
- \rffewvr\rfewvr\rvfewrr\rvrwefewv
Try:
([\\][A-Za-z0-9]+)+ Regexper[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hi would any one have a regex that would match (aug -) or(july -) or (june -)without the brackets
but would not match just (aug)or (july) or (june)
So far i have
\W*((?i)aug -(?-i))\W*
but this also matches aug which i dont want thanks
|
|
|
|
|
I tried your regex in Expresso, and it matches "hello aug -goodbye" but not "hello aug goodbye".
So ... what are you talking about?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
im using regex in placemint for placement of window and brousers
if i title a folder aug placemint macthes it , but i only want match on aug -
|
|
|
|
|
Im no ideas what should be captured, so Im guessing that it should include alternates like...
\W*(?i)((?:aug|july|june)(?-i) -)\W*
Except that both \W* are redundant since they allow 0-occurrences, so they dont alter any matched text.
Its best to include samples to keep the experts from guessing, so I will try to save them some troubles...
Capture 'aug' or 'July' or 'JUNE' as whole words if followed by: 1-space, 1-hyphen, 0-or-1 space, and a 1-or-2 digit word.
.*\W(?i)(aug|july|june(?-i)) - ?\d{1,2}\W.*
Capture 'aug -' or 'July -' or 'JUNE -' with the same conditions...
.*\W(?i)((?:aug|july|june(?-i)) -) ?\d{1,2}\W.*
Capture 'aug -##' or 'July - ##' or 'JUNE - ##' with the same conditions...
.*\W(?i)((?:aug|july|june(?-i)) - ?\d{1,2})\W.*
Capture 'aug -' or 'July -' or 'JUNE -' as whole words, but only if - is followed by a non-word character like %.
This does seem the most unlikely, but Im trying to copy your original match, because no samples are being posted...
.*\W(?i)((?:aug|july|june)(?-i) -)\W.*
If none of these match properly, you should include samples of your text lines, and say what should be captured.
There is many experts who is not even going to answer, without first seeing some samples.
modified 5-Oct-21 21:01pm.
|
|
|
|
|
Thanks for trying to help me with this, im a complete novice with regex
i am trying to capture 'aug -' or 'July -' or 'JUNE -'
sentance 'the aug' = would not match
sentance 'aug1' = would not match
sentance 'aug -2' = would not match
sentance 'aug -' = would match
|
|
|
|
|
Im guessing that you posted 4 complete samples, and that 'sentance' means 1 whole line?...
\b(?i)((?:aug|july|june)(?-i) -)$
modified 5-Oct-21 21:01pm.
|
|
|
|
|
yes thanks sentance means 1 whole line,
i tried \b(?i)((?:aug|july|june)(?-i) -)$
but its not matching anything
|
|
|
|
|
Its a PCRE regex to capture text just like your 4th-sample, so matching any lines that end like...
aug -
Maybe you're using something else?? Not using $1 or \1 for replace?? Not giving full samples??
modified 5-Oct-21 21:01pm.
|
|
|
|
|
example i use
\W*((?i)ALARM CLOCK(?-i))\W*
so any window that says alarm clock is placed at same position on desktop
|
|
|
|
|
Without full samples relating to your posted question, Im really afraid nobody is going to help you.
This site shows how my regex matches what you said needs to matched.
https://regex101.com/r/cH4Jrg/1
Feel free to experiment with it, if that's easier than trying to describe what should be matched.
modified 5-Oct-21 21:01pm.
|
|
|
|
|
Don't know if this is the correct solution but it seems to work.
Using the RegexOptions.RightToLeft option seems to work.
I'm not too familiar with Regex. I've created an expression to capture data in a line and it works except for the last group DataType which does not extract the value "dtText". Can someone help?
Thank You
Expression:
FieldName=(?<FieldName>.*?),ColumnWidth=(?<ColumnWidth>.*?),Size=(?<Size>.*?),DataType=(?<DataType>.*?)
Data:
FieldName=Field1,ColumnWidth=50,Size=10,DataType=dtText
Output:
FieldName: [Field1]
ColumnWidth: [50]
Size: [10]
DataType []
-- modified 22-Aug-21 19:28pm.
|
|
|
|
|
.*? tells the expression to capture as little as possible. Since there's nothing to match after the last expression, the least it can capture is nothing, so that's precisely what it does.
If you're looking to capture everything up to the end of the line, then you'll want to add an end-of-line anchor:
...,DataType=(?<DataType>.*?)$
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for your help
|
|
|
|
|
We are trying to create a new policy to detect Employer Identification Number (EIN) in MCAS. I'm very new to Regex so I need some help. We've tried the below regex and MCAS is showing me an error of: Capturing parenthesis not allowed in regular expression. Does anyone know how to convert the below regex to something without the capturing parentheses? Thanks!
([07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}
|
|
|
|
|
To prevent (Capturing|Groups), you can spec them as (?:Non|Capturing|Groups)
modified 5-Oct-21 21:01pm.
|
|
|
|
|
Hello,
I am trying to learn Regex on my own, but got stuck with select from an unordered list.
At this moment i managed to list the cattegories, but i cant figure how to
1) capture the node ID for each cattegory (for example 560884 for the first one)
2) how to define ">" not to be listed as cattegory.
Here is my code:
select div#wayfinding-breadcrumbs_feature_div li >>> category_tree {
select span.a-list-item >> category_name;
select div#wayfinding-breadcrumbs_container .a-link-normal >> attr(href) >> capture "[node=\\d+]" >> node_id;
}
Here is part of the output:
"category_tree": [{
"category_name": "Portable Sound & Video",
"node_id": null
}, {
"category_name": "›",
"node_id": null
}, {
"category_name": "Accessories",
"node_id": null
Here is source code:
<pre><div id="wayfinding-breadcrumbs_feature_div" class="a-subheader a-breadcrumb feature" data-feature-name="wayfinding-breadcrumbs" data-cel-widget="wayfinding-breadcrumbs_feature_div">
<ul class="a-unordered-list a-horizontal a-size-small">
<li>
<a class="a-link-normal a-color-tertiary" href="/mp3-ipod-headphones-DAB-radio/b/ref=dp_bc_aui_C_1?ie=UTF8&node=560884">
Portable Sound & Video
</a>
</li>
<li class="a-breadcrumb-divider">
›
</li>
<li>
<a class="a-link-normal a-color-tertiary" href="/Accessories-Portable-Sound-Vision-Tapes/b/ref=dp_bc_aui_C_2?ie=UTF8&node=560910">
Accessories
</a>
</li>
<li class="a-breadcrumb-divider">
›
</li>
<li>
<a class="a-link-normal a-color-tertiary" href="/b/ref=dp_bc_aui_C_3?ie=UTF8&node=16700222031">
Portable Speakers & Docks
</a>
</li>
</ul>
</div>
Thank you for your help
|
|
|
|
|
Jukec wrote: "[node=\\d+]"
No idea what language that is in. But all of the major ones use the same regex semantics for the most part.
The square brackets should not be there. Presumably the rest of the code is actually going to 'capture' what is matched. That is a specific term for regex.
If so it will look like 'node=16700222031' which means you would need to parse it again to get the number out.
|
|
|
|
|
I am trying to match the following sample patterns:
- 1
- 23-4B
- 2,1-12
- 15A
- 2-5,12
- 12A-4
so I tried the following regex but it seems it only matches some of above patterns...
^\d+[A-Z]?(-|,)?\d+[A-Z]?(-|,)?\d+[A-Z]?$
For example, the above matches all samples but not
- 1
- 15A
- 2,5
What did I miss here...
|
|
|
|
|
Hi!
Try this: ^\d*(-|,)?\w*(-|,)?\w*$
They all start with a indefinite digit at the beginning of string: ^\d*
In the middle there is optional characters: (-|,)?
Ending with either digit or letter: \w*
Hope it helps.
Nice day!
|
|
|
|
|
Thank you for the reply.
However, the above expression doesn't match the following test cases:
-2C-5,3
-2,1-12
-2-5,12
|
|
|
|
|
Hi!
You did not list them from the beginning.
But, as you do say about them now, it is matching:
^\d*(\w+)?(-|,)?\w*(-|,)?\w*$
Have a nice day!
|
|
|
|
|
You have six different patterns to match so regex is probably not the optimum choice of tool.
|
|
|
|