Drupal View Filter wole words - drupal-8

I have exposed an view filter in my drupal site and I have it return "Contains all words".
My problem is that it returns and partially matched results.
For example if I search "part" I will get results for "Parthenon" and "Part of statue", while I want to get result only for "Part of statue".
In other words I don't want to get partially matched word like "Parthenon" but only the whole word matches for "part" as the "Part of statue".
How can I achive that?

Related

Slash included words from string

I have a string as follows and I want to have only highlighted text in RegEx:
"Datapath from SF7PCRINFVCR1/MPLS to SF2PCRINFVCR1/MPLS for fwdClass fc_nc is down".
I have tried the RegEx (?<=Datapath from ).*?(?= for) but I am expecting the result as second row under Group Details [attached screenshot] with
Match#2 GroupIndex#1 and GroupContent as SF7PCRINFVCR1/MPLS to SF2PCRINFVCR1/MPLS from the below site as my integration tool is looking for second entry form the Group Details section.
https://www.freeformatter.com/java-regex-tester.html#before-output
Expecting output like

How to search for pages with titles starting with a specific phrase?

I'm a little confused as to how I'm supposed to put together the CQL search. Basically, I want to grab all pages that have titles starting with a specific set of strings in that specific order. Example:
Searching for "Test Page" should return:
Test Page
Test Page (1)
Test Page Again
It should NOT return:
Test
Page
Page Test
(1) Test Page
Again Test Page
I tried many searches, like:
title = "Test Page*"
title ~ "Test Page*"
title ~ "Test" AND title ~ "Page*"
But none of them match exactly what I need. What do I need to change to match the start of a title only?
Alternatively, if it's not possible to search for words at the start of a title, I'd be happy if I can just search something like "Test Page (*)", where * would match any character. Then it should return this:
Test Page (1)
Test Page (2)
But not this:
Test Page
Test Page Again
Test
Page
Page Test
(1) Test Page
Again Test Page
For CQL searches that contain an exact string or phrase, you should use the CONTAINS operator and surround the phrase with double quotes as you do in your second example:
title ~ "Test Page*"
CQL also supports the single character wildcard search symbol (?), so for the 'alternate' search you requested, the form should be:
title = "Test Page(?)"
While regular expressions syntax is allowed between back-slashes, I don't see any evidence that there can be selection by beginning (^) or end ($) of the element. However, using the EQULAS operator with the multi-character wildcard should give the same result:
title = "Test Page*"
So, according to all available documentation, including documentation for Apache Lucene upon which CQL is based, you are doing it right. You state that
'none of them match exactly what I need.'
Could you provide more information about why these queries were not correct?

Mariadb: Regexp_substr not working with non-matching group regular expression

I am using a query to pull a user ID from a column that contains text. This is for a forum system I am using and want to get the User id portion out of a text field that contains the full message. The query I am using is
SELECT REGEXP_SUBSTR(message, '(?:member: )(\d+)'
) AS user_id
from posts
where message like '%quote%';
Now ignoring the fact thats ugly SQL and not final I just need to get to the point where it reads the user ID. The following is an example of the text that you would see in the message column
`QUOTE="Moony, post: 967760, member: 22665"]I'm underwhelmed...[/QUOTE]
Hopefully we aren’t done yet and this is nothing but a depth signing!`
Is there something different about the regular expression when used in mariadb REGEXP_SUBST? this should be PCRE and works within regex testers and should read correctly. It should be looking for the group "member: " and then take the numbers after that and have a single match on all those posts.
This is an ugly hack/workaround that works by using a lookahead for the following "] however will not work if there are multiple quotes in a post
(?<=member: )\.+(?="])

Trying to select all text except for Twitter handle in Regex

I've exhausted everything I could find and just can't seem to get this to work. I have a .txt with rows of Twitter posts and I'm trying to delete everything but the #handles mentioned in the text.
For example:
Row1: This is the text of the tweet #Handle1
Row2: This text is meant for #Handle2 and #Handle3
Would result in:
Row1: #Handle1
Row2: #Handle2 #Handle3
I've come up with a regex expression to select the handles as: #[^\W]*
That works for all the handles in the set even if they have a colon or period immediately after them without a space (happens often).
I tried adding the negative lookahead command to it: (?!(#[^\W]*))
But I don't really know what else to add to make it work?
Thanks!
So you can loop through each row, and scan for the twitter handles.
For example,
str = "This text is meant for #Handle2 and #Handle3"
str.scan(/#\w+/).to_a #=> ["#Handle2", "#Handle3"]
Then you can manipulate the array however you want.
the \w is any alphanumeric and underscore character, you can modify that if you need any other characters.

REGEX: select everything to the left until the first specified delimeter

I'm using ColdFusion functions to query an Active Directory Database, return Membership information for a user, then REGEX functions to search the output for specified groups. I made "|" a delimiter.
Anyway, here's some example output:
CN=Group One,OU=Distribution Lists,DC=Domain,DC=org|CN=Group Two,OU=Distribution Lists,DC=Domain,DC=org|CN=Group Three,OU=Distribution Lists,DC=Domain,DC=org|CN=Group Four,OU=Distribution Lists,DC=Domain,DC=org|CN=Group Five,OU=Distribution Lists,DC=Domain,DC=org
What I would like to capture is this:
CN=Group Three,OU=Distribution Lists,DC=Domain,DC=org
Here is what I've tried so far:
^|CN=(.*Group? Three)
Here's a link to the example: http://rubular.com/r/DIGZOPwTag
What's my problem?
Well, this doesn't work all that great... It goes to the left, but it goes too far! How do I stop it at the first occurrence of |CN= to the left?
Thank you in advance for your time. It is appreciated.
!!Clarification!!
Better Example Output:
CN=Pay Band 50,OU=Distribution Lists,DC=Domain,DC=org|CN=Human Resources,OU=Distribution Lists,DC=Domain,DC=org|CN=SiteA Staff,OU=Distribution Lists,DC=Domain,DC=org|CN=SiteB Additional Staff,OU=Distribution Lists,DC=Domain,DC=org|CN=Executives,OU=Distribution Lists,DC=Domain,DC=org
Desired matches:
I'm looking for specific groups:
Site Name w/Possible Spaces Staff
Site Name w/Possible Spaces Additional Staff
It would be awesome to return: "StieAlpha Staff", "Site Beta Additional Staff". It would also be acceptable to include the "CN=" prefix because I could use it to do queries later.
"Staff" and "Additional Staff" will always be part of the group(s) I want to match.
What I've tried, again
^|CN=[^|CN=]*? Staff|Additional? Staff
This new example is not quite perfect as it doesn't grab all of "Site Beta". "Site Beta" Could be any name of any building, for example.
example link: http://rubular.com/r/vq5JcrvaBR
It is not really clear what you want to extract, if only the "Group Three" CN value or all CN values.
You can extract every CN value with this regex:
CN=([^,]*)
this regex begins extracting after each "CN=" occurence and continues extraction until the first comma (,).
A RegEx to fit your demands is
^.*?\|. Visualisation: