How can I select occurrences of variables in PhpStorm rather than just any text in the editor?
In PhpStorm Alt + J will select next occurrence in text like so:
Is there an action to select next occurrence of symbol (not just text)? like so:
In order to select next occurance of "symbol" you have to place your cursor on the word without selecting it and then hit Alt + J.
If you want to select the next occurance of text then you have to select the text first and then hit Alt + J.
So basically it behaves differently if you have selected a text or not.
Related
I need to copy rows, but I also need, to change path field:
old path value = '<src_dir>'/workspace_id/project_id/file_id.file_format
new path value = '<src_dir>'/workspace_id/new_project_id/new_file_id.file_format
I tried to find the dot position and count from it two uuid lengths + slash and put there new slash-separated project and file IDs
overlay(path, placing '{<new_project_id>}/{<new_file_id>}' from (position('.' in path)-(36 * 2 + 1) for (36 * 2 + 1)))
But if a src_dir contains a dot in its name, the position of that dot will be taken. Is there any way to take the position of the last dot?
You can use REVERSE() function along with LENGTH() such as
SELECT LENGTH(path) - POSITION( '.' IN REVERSE(path)) + 1
FROM t
Demo
this case the last dot would be positioned as the first
Okay, I am not pro in regexp, it can it could be much prettier, but it works:
regexp_replace(path, '([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/(([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.)', '{new_project_id}/{new_file_id}.')
First, add all cursors,
And, select the word (Add Selection for next Occurrence, cmd + D), the result is
The expectation is to select all the words with my cursors, like this in Sublime Text, how can I do like this?
I have a column of product numbers that are all formatted like this:
MK444LLA
...same number and letter pattern, same character count. I need to insert a / into each cell so they all end up like this:
MK444LL/A
I'm thinking I just need a solution for the first row, which I can then apply to the entire column.
Use the Left and Right string functions and concatenate the three parts together with &.
Left(Range("A1").Text, 7) & "/" & Right(Range("A1").Text, 1)
Left(Range("A1").Text, 7) - this returns the first seven characters.
Right(Range("A1").Text, 1) - this returns the last character.
I current have one table whereby with a unique index of 'col_0' I have the same set of data for 2 different indexes. The problem is the copy function in my application automatically cuts of the description and adds "copied from at the end".
Example
Col_0 Description
A This is a very annoying application problem
B This is a very annoy (Copied from column a)
I just wanted to search for and then update B so it matches I've tried join it by part of the description.
So far I've tried CHARINDEX but I can't quite get it right.
I read your request thus: "Copied from column a)" means copied from the description of the record with col_0 = 'A'. And you want to update all "copied from .." descriptions with their original description.
In order to find the "copied from .." records I am using LIKE. To extract the col_0 value from the string I am using some string functions (mainly REVERSE + CHARINDEX to find the last occurrence of a blank and then SUBSTRING for the extraction).
update mytable upd
set description =
(
select description
from mytable orig
where orig.col_0 =
substring(upd.description,
len(upd.description) - charindex(' ', reverse(upd.description)) + 2,
charindex(' ', reverse(upd.description) - 2
)
)
where description like '%(Copied from column %)';
How would i go about constructing a query, that would return all material numbers that have a "blank white space" either BEFORE or AFTER the number string? We are exporting straight from SSMS to excel and we see the problem in the spreadsheet. If i could return all of the material numbers with spaces.. i could go in and edit them or do a replace to fix this issue prior to exporting! (the mtrl numbers are imported in via a windows application that users upload an excel template to. This template has all of this data and sometimes they place in spaces in or after the material number). The query we have used to work but now it does not return anything, but upon export we identify these problems you see highlighted in the screenshot (left screenshot) and then query to find that mtrl # in the table (right screenshot). And indeed, it has a space before the 1.
Currently the query we use looks like:
SELECT Mtrl
FROM dbo.Source
WHERE Mtrl LIKE '% %'
Since you are getting the data from a query, you should just have that query remove any potential spaces using LTRIM and RTRIM:
LTRIM(RTRIM([MTRL]))
Keep in mind that these two commands remove only spaces, not tabs or returns or other white-space characters.
Doing the above will make sure that the data for the entire set of data is fine, whether or not you find it and/or fix it.
Or, since you are copying-and-pasting from the Results Grid into Excel, you can just CONVERT the value to a number which will naturally remove any spaces:
SELECT CONVERT(INT, ' 12 ');
Returns:
12
So you would just use:
CONVERT(INT, [MRTL])
Now, if you want to find the data that has anything that is not a digit in it, you would use this:
SELECT Mtrl
FROM dbo.Source
WHERE [Mtrl] LIKE '%[^0-9]%'; -- any single non-digit character
If the issue is with non-space white-space characters, you can find out which ones they are via the following (to find them at the beginning instead of at the end, change the RIGHT to be LEFT):
;WITH cte AS
(
SELECT UNICODE(RIGHT([MTRL], 1)) AS [CharVal]
FROM dbo.Source
)
SELECT *
FROM cte
WHERE cte.[CharVal] NOT BETWEEN 48 AND 57 -- digits 0 - 9
AND cte.[CharVal] <> 32; -- space
And you can fix in one shot using the following, which removes regular spaces (char 32 via LTRIM/RTRIM), tabs (char 9), and non-breaking spaces (char 160):
UPDATE src
SET src.[Mtrl] = REPLACE(
REPLACE(
LTRIM(RTRIM(src.[Mtrl])),
CHAR(160),
''),
CHAR(9),
'')
FROM dbo.Source src
WHERE src.[Mtrl] LIKE '%[' -- find rows with any of the following characters
+ CHAR(9) -- tab
+ CHAR(32) -- space
+ CHAR(160) -- non-breaking space
+ ']%';
Here I used the same WHERE condition that you have since if there can't be any spaces then it doesn't matter if you check both ends or for any at all (and maybe it is faster to have a single LIKE instead of two).