Selenium IDE: how to verify the stored text without some symbol - selenium

I store the text in the format "№XXX"
storeText | css=span.ng-binding | order_number
I need to verify this text in the other location using:
verifyText | //div[#id='myorders']/div/table/tbody/tr[1]/td | ${order_number}.
The problem is that in that location this text is displayed without the symbol "№" - "XXX" only.
How i can to verify the match of this text?

If the text in one location has the leading character, but not in the other, then after you save the string, strip off the first character and compare to that. You can use any number of methods to do that (see Delete first character of a string in Javascript).
Klendathu

I found the solution:
storeText | css=span.ng-binding | order_number
storeEval | storedVars['order_number'].replace('№','') | order_number

Related

Splunk: How to extract a field containing spaces at end

I try to extract the value of a field that contains spaces. Apparently it is hard to find a regular expression for this case (even the question is if it is possible at all).
Example: 03 Container ID - ALL_ELIGIBLE_STG_RTAIN Offer Set ID
From Above example, we have to get the count Container ID - ALL_ELIGIBLE_STG_RTAIN
I am Expecting like this.
Container ID
Count
ALL_ELIGIBLE_STG_RTAIN
xxxx
Assuming all container IDs are preceded by "Container ID - " then this command will extract them.
| rex "Container ID - (?<ContainerID>\S+)"

BigQuery extract string between two "."

I have three string types:
'en-ae.sssports.com','amazon.co.uk','farfetch.com'
I require the client name i.e. Sssports, Amazon, Farfetch from each.
Had tried using regexp '(?:.)[^.]*(?:.)' to extract string between the two dots but I require a dynamic code that extracts data from all three sting types.
You may try below query
SELECT INITCAP(RTRIM(NET.REG_DOMAIN(str), '.' || NET.PUBLIC_SUFFIX(str))) AS client_name
FROM UNNEST(['en-ae.sssports.com','amazon.co.uk','farfetch.com']) str
Query reesults
+-------------+
| client_name |
+-------------+
| Sssports |
| Amazon |
| Farfetch |
+-------------+
References
NET.REG_DOMAIN()
Takes a URL as a STRING and returns the registered or registerable domain (the public suffix plus one preceding label), as a STRING.
NET.PUBLIC_SUFFIX()
Takes a URL as a STRING and returns the public suffix (such as com, org, or net) as a STRING.

How to extract string between quotes, with a delimiter in Snowflake

I've got a bunch of fields which are double quoted with delimiters but for the life of me, I'm unable to get any regex to pull out what I need.
In short - the delimiters can be in any order and I just need the value that's between the double quotes after each delimiter. Some sample data is below, can anyone help with what regex might extract each value? I've tried
'delimiter_1=\\W+\\w+'
but I only seem to get the first word after the delimiter (unfortunately - they do have spaces in the value)
some content delimiter_1="some value" delimiter_2="some other value" delimiter_4="another value" delimiter_3="the last value"
The problem is returning a varying numbers of values from the regex function. For example, if you know that there will 4 delimiters, then you can use REGEXP_SUBSTR for each match, but if the text will have varying delimiters, this approach doesn't work.
I think the best solution is to write a function to parse the text:
create or replace function superparser( SRC varchar )
returns array
language javascript
as
$$
const regexp = /([^ =]*)="([^"]*)"/gm;
const array = [...SRC.matchAll(regexp)]
return array;
$$;
Then you can use LATERAL FLATTEN to process the returning values from the function:
select f.VALUE[1]::STRING key, f.VALUE[2]::STRING value
from values ('some content delimiter_1="some value" delimiter_2="some other value" delimiter_4="another value" delimiter_3="the last value"') tmp(x),
lateral flatten( superparser(x) ) f;
+-------------+------------------+
| KEY | VALUE |
+-------------+------------------+
| delimiter_1 | some value |
| delimiter_2 | some other value |
| delimiter_4 | another value |
| delimiter_3 | the last value |
+-------------+------------------+

SQL pad column content with tabs instead of spaces

I am dynamically creating a column via a SELECT statement. The content of this column is a string which is then used as content for an e-mail.
The text looks like this:
text 1 | text 2 | text 3 | ...
text 123 | text 223 | text 323 | ...
as you see, the two lines are not aligned. The expected output should be like this:
text 1 | text 2 | text 3 | ...
text 123 | text 223 | text 323 | ...
The obvious solution is to pad each field in order for each field to have the same size. for this i used the following code:
LEFT(field1 + REPLICATE(' ', 20), 20)
My issue is, that in Outlook the text is still not shown properly aligned even though, if I copy the text into Notepad, it is properly aligned. The reason is, that Outlook uses Arial for displaying text-mails and in Arial blank-spaces do not have the same size as the other characters. Hence the padding does not yield the expected result.
My question now is: Is there some other way to use this padding approach in order to get same size displayed fields in Outlook Mails? Probably by padding with tabs? But I think my approach above then does not work anymore...
Regarding the TAB, it dawned on me that you were talking about trailing tabs
Declare #Table table (SomeField varchar(50))
Insert into #Table values
('Some Text'),
('Some Longer Text with more')
Select String = SomeField+replicate(char(9),(30-Len(SomeField))/4)+'|'
From #Table
Returns
Some Text |
Some Longer Text with more |
If you don't want (or can't) create the HTML as #techspider and #Shnugo mentioned, you could simply cast your string as a char(20)
cast(field1 as char(20))
For Example
Select '| '+cast('text1' as char(20))+' | '+cast('text1' as char(20))+'|'
Returns
| text1 | text1 |

PostgreSQL String search for partial patterns removing exrtaneous characters

Looking for a simple SQL (PostgreSQL) regular expression or similar solution (maybe soundex) that will allow a flexible search. So that dashes, spaces and such are omitted during the search. As part of the search and only the raw characters are searched in the table.:
Currently using:
SELECT * FROM Productions WHERE part_no ~* '%search_term%'
If user types UTR-1 it fails to bring up UTR1 or UTR 1 stored in the database.
But the matches do not happen when a part_no has a dash and the user omits this character (or vice versa)
EXAMPLE search for part UTR-1 should find all matches below.
UTR1
UTR --1
UTR 1
any suggestions...
You may well find the offical, built-in (from 8.3 at least) fulltext search capabilities in postrgesql worth looking at:
http://www.postgresql.org/docs/8.3/static/textsearch.html
For example:
It is possible for the parser to produce overlapping tokens from the
same of text.
As an example, a hyphenated word will be reported both as the entire word
and as each component:
SELECT alias, description, token FROM ts_debug('foo-bar-beta1');
alias | description | token
-----------------+------------------------------------------+---------------
numhword | Hyphenated word, letters and digits | foo-bar-beta1
hword_asciipart | Hyphenated word part, all ASCII | foo
blank | Space symbols | -
hword_asciipart | Hyphenated word part, all ASCII | bar
blank | Space symbols | -
hword_numpart | Hyphenated word part, letters and digits | beta1
SELECT *
FROM Productions
WHERE REGEXP_REPLACE(part_no, '[^[:alnum:]]', '')
= REGEXP_REPLACE('UTR-1', '[^[:alnum:]]', '')
Create an index on REGEXP_REPLACE(part_no, '[^[:alnum:]]', '') for this to work fast.