iMacros math operators on TAG CONTENT - imacros

iMacros v10.1.1 for CR, Free, CR 102.0.5005.115, Win10
I have a few lines of TAGs that I want to work with the same base CONTENT. I want to sum different values for each line, something like:
ATTR=1 CONTENT={{!VAR1}} + 65
ATTR=2 CONTENT={{!VAR1}} + 200
The point is, I need to make those operations with only one variable.
Is there any way to do it?

Related

Retrieving the 12th through 14th characters from a long strong using ONLY regex - Grafana variable

I have a small issue, I am trying to get specific characters from a long string using regex but I am having trouble.
Workflow
Prometheus --> Grafana --> Variable (using regex)
I can't use anything other than Regex expressions to achieve this result
I am currently using this expression to grab the long string from some json output:
.*channel_id="(.*?)".*
FROM THIS
{account_id="XXXXXXX-xxxx-xxxx-xxxx-xxxxxxxxxx",account_name="testalpha",channel_id="s0022110430col0901241usa",channel_abbr="s0022109430col}
This returns a string that's ALWAYS 24 characters long:
s0022110430col0901241usa
PROBLEM:
I need to grab the 3 letters 'col' and 'usa' as they are the two teams that are playing, ideally I would be able to pipe the results from the first regex to get these values (the position is key, since the first value will ALWAYS be the 12-14th characters and the second value is the last 3 characters) if I could output these values in uppercase with the string "vs" in between to create a string such as:
COL vs USA
or
ARG vs BRA
I am open to any and every suggestion anyone may have
Thank you!
PS - The uppercase thing is 'nice to have' BUT not needed
I'm still learning RegEx, so this is all I could come up with:
For the col (first team):
(?<=(channel_id=".{11}))\w{3}
For the usa (second team):
(?<=(channel_id=".{21}))\w{3}
Can you define the channel_id?
It begins with 's' and then there are many numbers. If they are always numbers, you can use this regex:
channel_id=".[0-9]+([a-z]+)[0-9]+([a-z]+)
You will get 2 groups, one with "col" and the other with "usa".
Edit:
Or if you just know, that you have always the same size, you can use something like:
channel_id=".{11}([a-z]+).{7}([a-z]+)

BigQuery string comparison and adjustment with replace/trim

I tried to accommodate in BigQuery for inputs with bad spacing.
However, I keep getting weird results, basically saying that abc <> abc.
Can anyone explain how this is possible?
I tried to adjust this by using replace and rtrim but none of them served the purpose.
Thank you
SELECT o = t,o, t, length(o) as lon_o, length(t) as len_t
from
(select replace('abc ',' ','') o,
'abc' as t)
I was able easily reproduce your case by having (for example) few tabs inside that string instead of spaces -
visually they look exactly alike - but first row has 64 spaces in it whereas second row has 5 tabs and 44 spaces. In Web UI each tab occupy 2 char-places so that is why total 5 tabs + 44 spaces look like 64 spaces (exactly as in first row)
To address this - you can use REGEXP_REPLACE instead of REPLACE
Using REGEXP_REPLACE allows you to 'remove' all white spaces, as in example below (the only difference here is in second row - using REGEXP_REPLACE instead of REPLACE and use of r'\s' instead ' '
And, finally - if to get back to first example - the good way of seeing what actually makes those 8 chars vs. 3 chars in result's lon_o is to switch from Table viewtoJSON` view as below
This is working for me
Check if you don't have hidden ASCII chars in your text which might be causing this for example HEX 80

Removing quotes and spaces in SAS dataset

I am working in SAS EG and DI, facing a very peculiar problem.
When I look into a column of a dataset in SAS DI Studio or EG, it is appearing fine. But when I paste the data into notepad, some quotes and spaces are appearing.
The data which I am seeing in EG:
But the same data when copied into Notepad,
extra quotes and spaces are appearing like this(in 6th row):
I found this problem when I am using this field as a key in a join, the other related column values for 6th row are not going to the output as the match is failing for that 6th record.
I tried many things like tranwrd,dequote and compress but none of them is changing my result.
Can someone please help in understanding what the problem is and how can this be solved.
Take a look at what is in the column so that you can decide how to handle it. This query will show you both the character string and the Hexadecimal representation of the string.
proc sql;
select postcode,put(trim(postcode),$hex.) as hexcode,count(*) as nobs
from x
group by 1,2
;
quit;
So if you see hex characters like 0A, 0D, A0, 08 or other non-printable codes then you can figure out what is happening.
So you might see that you have POSTCODE='LS5 3BT' with HEXCODE='4C533520334254' for most of the records. But perhaps have some that look like the POSTCODE='LS5 3BT', but the value of HEXCODE is something like '0A4C533520334254' which would mean that you have a linefeed character at the beginning of the string. Or perhaps instead of space ('20'X) you have a tab ('09'X) in the middle of the string.

How to copy a regular expression matched in notepad++ and the inverse selection of it

Example for Context
How do you search for the first two characters in every row, select them and then copy them, in NotePad++?
Vice verse = Find everything NOT the first two characters, select them and be able to to cut/copy them.
The specific goal is to auto select the matching regex result so that the found text can be copied to the clip board. NotePad++, to my knowledge, is only able to "Mark" the results found (apply slightly different coloration for visual distinction)- this to me seems counter intuitive not to be able to also "Select" the results found.
Any help here would be greatly appreciated.
In the following list:
09 - ExtraCare Stockpiler
01 - Food & Family Loyalist
04 - ExtraCare Enthusiast
09 - ExtraCare Stockpiler
The regex should return:
09
01
04
09
INVERTED
The same list should return:
- ExtraCare Stockpiler
- Food & Family Loyalist
- ExtraCare Enthusiast
- ExtraCare Stockpiler
Once the above is sorted out, what is the method to select the results so that they can be copied to the clipboard.
Note: Block selection (ALT + Click drag) is not an option because there are 180,000+ rows.
The way I would do this is as follows.
Use a regular expression replace to keep the wanted characters and to delete the unwanted characters. Copy the entire buffer that now contains only the wanted characters and paste into the destination. Then either "undo" the edit replace or reload the file (menu => File => Reload from disc) or just discard the buffer. A minor variation is to: copy the whole of the original buffer, or just the relevant section, into a temporary buffer; do the replacement; copy; paste; then discard the temporary buffer.
To keep only the first two characters of each line of a buffer: Replace ^(..).*$ with \1. To keep everything except the first two characters of each line of a buffer: Replace ^..(.*)$ with \1. In both cases ensure that ". matches newline" is not selected.
The question is not precise on how lines with zero, one or two characters should be processed. The replacements in the previous paragraph will not alter or delete those lines. Hence it may be necessary to precede the above replacements with something to filter out the short lines.

How do I concatenate cells and add extra text?

I'm very new to Calc but a relative veteran with Excel. Unfortunately I don't have the latter available to me. I'm attempting to create a new cell inline with the data I need to use like the below
AF Afghanistan
AL Albania
DZ Algeria
with an output in Column C like this
<option value="AF">Afghanistan</option>
I've tried to use the CONCATENATE function to no avail. Could someone point me in the right direction on how to achieve this in OpenOffice Calc (Version 3).
Thanks
I suppose it's a problem of escaping the quotes, since they delimit the "extra strings", too. Anyway, it should work with CONCATENATE, using this formula:
=CONCATENATE("<option value=""";A1;""">";B1;"</option>")
EDIT:
Sorry, every time messing up argument separators (with german l11n, semicolons instead of commata are used...) With an english (US) localisation, you need this version:
=CONCATENATE("<option value=""",A1,""">",B1,"</option>")
If doubling the qoutes around the first cell reference doesn't work, try to replace it with CHAR(34) (the decimal ASCII code for double quotes is 34, while 22 would be the hex value):
=CONCATENATE("<option value=",CHAR(34),A1,CHAR(34),">",B1,"</option>")
suppose 'AF' was in column A1 and 'Afghanistan' was in column C1, then this would produce the desired result
="<option value='"&A1&"'>"&C1&"</option>"
That code would give you this output
<option value='AF'>Afghanistan</option>