Regex for Word.AnotherWord - regex

In Vb.NET I want to check a string if it is something like:
package_name.Procedure_name or
PackageName.Procedure_Name_Something_Else or
package_name.ProcedureName
So I need something like: word.otherWord
My problem is that I have tried many regexs but I wasn't able to achieve my goal.
The latest regex expression that I tried is : ([\w-#]+\.)+([\w-#]) which matches up to the first character after the dot.
Can anyone show me a direction or a hint?

your regex should be
[\w-#]+[.][\w-#]+

Related

Nino Regular Expression

I have the following text, for example:
nino&searchPhrase=jn123456&alphabetical
And I want to extract jn123456.
I've put together the following regex to extract NINOs:
(\bnino?\b.*?|Nino?\b.*?)[a-zA-Z]{2}[0-9]{6}
The problem I have is at the very end of the regex where I'm matching the last alpha character which may or may not be there.
I've tried adding the following at the end of the regex shown above without any luck:
?[a-zA-Z]{1} and
[?a-zA-Z]{1}
Could someone please look at this and let me know where I've gone wrong.
Many thanks and kind regards
Chris
You may use something like this:
^[Nn]ino&?\w*=([a-z]{2}\d{6})
which will capture "jn123456" in the first capturing group.
Demo.
If the character & can be anything else, then you may use . instead.

Match a url with quety string

I'm pretty new to regex.
I researched a lot, but I can't figure out the problem.
I have this url
https://kompozitor.fr/thenotebar/?s=test.
The query string ?s= is the search parameter on my blog.
I'd like to write a regex expression that matches only
/thenotebar/?s=
and any parameter given to the search engine.
I tried a few things like /thenotebar/\?s=(.*)
,but it didn't work.
Any help is appreciated. Thank you in advance.
As I understand, you need the "thenotebar/?s=" and at least one character in the parameters.
Try to use this regex for it.
/\/thenotebar\/\?s=.(.*)/g
In your regex, you miss the '\' before the '/', probably this is the reason, it not works. You need a dot before (.*). This means you need at least one character as parameter. You need it? Leave this extra dot if you only check the "/thenotebar/?s=" string.

Issues with RegEx

I am trying to make an if-then-else statement using RegEx. I want to match the text if it contains Monty and also contains Python. Also the text should get matched if Monty is not present in the text.
RegEx
(?(?=Monty)(?(?=Python).*|)|^.*).*$
Kindly help!
How about this:
(^(?!.*Monty(?!.*Python.*).*).*$|^.*Python.*Monty.*$)
This passes my tests, but let me know if it works for you.
I am not versed in lookahead regex but just tried to build the regex from what I understood from above description. Check the link to see if this is what you are trying to do.
try this instead
((?=Monty)((?=Python).*|)|^.*).*$

Filtering specific word form sentence by regex

I am trying to make a regular expression which will give an error when user will give specific input like feat, ft. I do want to allow this kind of input in a sentence. How can I solved this problem.
For example:
The feat-incorrect
featable-corroct
rahin (feat)-incorrect
feat-incorrect
I create one
regex: /^(?!.(feat|artists|Diverse artister|Feat|Feat.Featuring)).$/
in this regex
featable- is incorrect. But I need this one correct
has Anyone solved this kind of problem? Thanks in advance.
If your question is how to create a REGEX that selects whole words and not part of a word then try something like this:
\bfeat\b
If you want the only correct word to be featable then use \bfeatable\b
check out this Regex Expression builder, its useful. the builder would highlight the correct words for the expression you put.

Regular Expression for recognizing files with following patterns az.4.0.0.119.tgz

I am trying to find a regular expression that will recognize files with the pattern as az.4.0.0.119.tgz. I have tried the regular expression below:
([a-z]+)[.][0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}[.]tgz
But, no luck. Can anyone please point me in the right direction.
Regards,
Shreyas
Better to use a simple regex like this:
^([a-z]+)\.(?:[0-9]+\.)+tgz$
You just forgot one number part:
([a-z]+)[.][0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}[.]tgz
or
([a-z]+)[.]([0-9]{0,3}[.]){4}tgz
Depending on where and how you use the regex, you might want to surround it in ^...$.
Your pattern has 4 chiffers group, your regexp only 3.