How to read numbers in powershell - powershell

How to read numbers in powershell can anyone please explain me this thing coded in power shell its coded like
if(($commit Id -match 'release(-)\d+(.\d)+(.\d)$')) {echo $ci_commit}
please need a explanation for the above code snippet i did'nt get what is coded in release(...)

That thing is called a regular expression, and are a cornerstone of formal language theory in computer science. There are tons of tutorials available of different focus. For a visual representation, there are tools too.
That being said,
if(($commit Id -match 'release(-)\d+(.\d)+(.\d)$')) {echo $ci_commit}
means that - skipping the obvious mistake in $commit Id as it cannot have a space - means that it will look for text release-, followed by numbers, anything, numbers, dot, number and end of line.
If you need help how to create a regex, ask a new question with your attempt of regex and (wrong) results. Include some example data and what you'd like to get out of it. If there are things that should not be matched, or tricky edge cases, add those too.

Related

What is the dollar caret zero variable ( $^0 ) in Perl?

I've found some Perl code that makes the following check:
if ($^O eq 'MSWin32')
What is the $^0 variable? It looks like it contains the architecture/OS of the machine it's running on, but I don't know if that's the result of assigning it elsewhere in the script (maybe it's the result of a regex match, though I can't see any match operations performed before that point), or whether that variable always has a value related to the machine it's running on.
I'd like to check the OS and bitness of the machine running the script, and would like to know if I can use $^0 to help me with that (if not, then I'm still curious what it is).
I'd rather not publish other parts of the Perl script, as it's proprietary.
This strikes me as the sort of question that should have been asked before, but Google isn't much use, thanks to the special characters (I often think the inability to Google Perl code led in part to its demise), and Stack Overflow doesn't have any useful suggested questions either.
There's no match for $^0 or $^1 or $^# on the perlvar page, and I'm not convinced that $^N or $^X are related.
It is not a zero.
It is the letter "O", capitalized.
In perlvar, search for OSNAME, which is the long form name of the variable when you use English:
The name of the operating system under which this copy of Perl was
built, as determined during the configuration process.
There is no special "dollar caret zero" variable.

What is "dont" and "isnt" in the pertained GloVe vector files (e.g. glove.6B.50d.txt)?

I found these 2 words "dont" and "isnt" in the vector file glove.6B.50d.txt downloaded from https://nlp.stanford.edu/projects/glove/. I wonder if they were originally "don't" and "isn't". This will likely depend on the sentence_to_word parsing algorithms they used. If someone is familiar, please confirm if this is the case.
A secondary question is if this is a common way to deal with apostrophe for words like "don't", "isn't", "hasn't" and so on. i.e. just filter replace that apostrophe with an empty string such that "don" and "t" becomes one word.
Finally, I am also not sure if GloVe comes with API to do sentence_to_word parsing so you can be consistent with what the researchers have done originally.
I think dont and isnt really are originally don't and isn't. I have seen a few other such examples. I suspect this is just the specific way GloVe researchers handle this.

Check if word is part of contextfree language

Good evening to all!
As a fan of regular expressions in Perl, I came up with a question, which I could not answer by googling and searching for myself.
So let me give you a minimal example of my problem:
I have two text-files:
FileA.txt:
aaabbb
FileB.txt:
abbb
I want to check each file-content if it is a word, generated by a specific contextfree language. For example in this case:
L={a^nb^n | n > 0}.
Now I have the problem, that the regex from Perl won't work, since it isn't a regular language.
For sure I could script a little PDA and check if it terminates.
But is there another way in Perl to solve this problem? Maybe a way to pass a context-free-grammar or sth.?

CLUTO doc2mat specified stop word list not working

I am trying to convert my documents into vector-space format using doc2mat
On the website, it says I can use my specified text file where words are white-space separated or on multiple lines. So, I use some code similar to this one:
./doc2mat -mystoplist=stopword.txt -skipnumeric mydocuments.txt myvectorspace.txt
However, when I check the output .clabel file, it still has stop words that's in stopword.txt.
I really do not know how to do this. Someone help me out please? Thank you!
There's one important thing I should remember: I should include ALL the unwanted words in my stop list. This is somewhat difficult since there's always some variations available...
For example, if I want to exclude method I add it to my list. However, the resulting vocabulary may also contain method since there are words like methodist, methods, etc. Then doc2mat by default stems these words and I will still get method in the output.
Another thing is to make sure that "-nostop" option must be provided for user-specified stop list.

How to find literals in source code of Smartforms and in SAPScripts (or reports, if the others can't be done)

I'd like to check hardcoded values in (a lot of) Smartforms and SAPScript forms.
I have found a way to read the source code of both of these, but it seems that i will have to go through a lot of parsing before I get anything reliable.
I've come across function module GET_LITERAL but that doesn't seem to help me much since i have to specify the offset of the value, if i got right what the function is doing in the first place.
I also found RS_LITERAL_LIST but that also doesn't do what i expect.
I also tried searching for reports and methods, but haven't found anything that seemed to help.
A backup plan would be to get some good parsing tool, so do you know of anything like that.
Anyway, any hints would be helpful and appreciated.
[EDIT]
Forgot to mention, the version of my system is 4.6C
If you have a fairly recent version of ABAP, you can use a regex.
Follow the pattern of this example, but use your source as the text and create your own regex. Have it look for any single quotes on the end of a word separated by spaces or any integers with spaces on either side. That's just a start, you might need to work on a better pattern.
String functions count, find, and match