#1
|
|||
|
|||
Extract a path from any code
Extract a path from any code
It does not work with me. ^"[^"]*","(Q:\\AK\s(.*)[^"]*)" U:\AK.csv(17582306): "y_ddc1d451.jpg","Q:\AK Rysunki ALL!!\-3084290_46842073","117 KB","08-05-13 23:57:00" |
#2
|
||||
|
||||
this pattern works fine
Code:
^"[^"]*","(Q:\\AK[^"]*)"
__________________
JD-Dev & Server-Admin |
#3
|
||||
|
||||
this is wrong. .* -> everything
[^"]* everything except ", but your everything (.*) will *eat* all
__________________
JD-Dev & Server-Admin |
#4
|
|||
|
|||
I have only two engines to choose from
Boost.Regex, Onigmo It really does not work: Code:
Info: Cannot find ^"[^"]*","(Q:\\AK[^"]*)" |
#5
|
|||
|
|||
Not work for me screenshot:
https://s33.postimg.cc/4iqrz4zkv/Scr...t_06.33_PM.jpg |
#6
|
||||
|
||||
Quote:
Code:
"y_ddc1d451.jpg","Q:\AK Rysunki ALL!!\-3084290_46842073","117 KB","08-05-13 23:57:00"
__________________
JD-Dev & Server-Admin |
#7
|
|||
|
|||
@Jiaz - Your regex is invalid - it does not match complex folder names (path)
|
#8
|
|||
|
|||
@Jiaz - But I gave another example line, it's completely different!
|
#9
|
|||
|
|||
1. you gave another example, so it does not work correctly
2. I want to extract only the folder name, not the whole code name. |
#10
|
|||
|
|||
Quote:
Space must be kept, do not combine other names |
#11
|
|||
|
|||
Example:
Step 1: Code:
U:\AK.csv(17582306): "y_ddc1d451.jpg","Q:\AK Rysunki ALL!!\-3084290_46842073","117 KB","08-05-13 23:57:00" I want Extract Path Foldername Code:
Q:\AK Rysunki ALL!! |
#12
|
||||
|
||||
Your pattern began with ^" so I though your example starts with the actual line
__________________
JD-Dev & Server-Admin |
#13
|
||||
|
||||
Code:
.*"[^"]*","(Q:\\AK([^"]*\\)*) Code:
U:\AK.csv(17582306): "y_ddc1d451.jpg","Q:\AK Rysunki ALL!!\-3084290_46842073","117 KB","08-05-13 23:57:00" Code:
Q:\AK Rysunki ALL!!\
__________________
JD-Dev & Server-Admin |
#14
|
|||
|
|||
This modified regex is still invalid because it does not include spaces and any other name always with one space
(Q:\\AK[^"]*) It matches folder+subfolders here, and I just want ONLY folder name |
#15
|
||||
|
||||
I don't understand what you want but you should easily be able to modify to your needs.
It returns the full path if you don't want the full path, then modify the pattern
__________________
JD-Dev & Server-Admin |
#16
|
|||
|
|||
but what regular expression after \s ???
|
#17
|
||||
|
||||
What exactly from
Code:
Q:\AK Rysunki ALL!!\-3084290_46842073 1.) Q:\AK Rysunki ALL!! 2.) AK Rysunki ALL!! 3.) Rysunki ALL!! 4.) Rysunki 5.) ???
__________________
JD-Dev & Server-Admin |
#18
|
|||
|
|||
1.) Q:\AK Rysunki ALL!! (yes)
1.) Q:\AKRysunki ALL!! (no) Each folder always starts name "AK " the folder name can contain numbers, letters, various characters, and russian unicode |
#19
|
||||
|
||||
Code:
.*"[^"]*","(Q:\\AK\s+([^"]*\\)*)
__________________
JD-Dev & Server-Admin |
#20
|
|||
|
|||
Quote:
Please, give me only for the name of the folder, it should work properly then. Screenshot: https://s33.postimg.cc/3nco2kyu7/Scr...t_08.34_PM.jpg |
#21
|
||||
|
||||
Works fine in Regex101 with multiple example lines
Maybe your tool/editor you have to escape the ", I don't know. The pattern is correct and working , you can easily validate with regex101 for yourself
__________________
JD-Dev & Server-Admin |
#22
|
|||
|
|||
shows the group on regex101.com, but I want to extract specific text in the Text Editor, it can not be extracted in a web browser due to the limitations of computing speed, power and memory.
The result is completely different than I expect Working but (!) -> I only want folder names, not this result: Wrong Match 1: U:\AK.csv(17582306): "y_ddc1d451.jpg","Q:\AK Rysunki ALL!!\ |
#23
|
|||
|
|||
regular expression syntax is based on Perl regular expression syntax.
Literals All characters are literals except: ".", "*", "?", "+", "(", ")", "{", "}", "[", "]", "^", "$", "|", and "". These characters are literals when preceded by a "". A literal is a character that matches itself. For example, searching for "\?" will match every "?" in the document, or searching for "Hello" will match every "Hello" in the document. Wrong regex [C-Z]:\\IX\s., does not match the full folder name [/I] is: X:\IX 1 shouldbe: X:\IX 123 56\ Perl Regex engine |
#24
|
|||
|
|||
My regex should work now:
Code:
[Q-Z]:\\AK\s.+\\ |
#25
|
||||
|
||||
Quote:
and the next one is . = ONE any, just ONE. That's why the pattern returns X:\IX(one whitespace)(one any)
__________________
JD-Dev & Server-Admin |
#26
|
|||
|
|||
regex finds Russian words, but not Chinese. Probably need to set a simplified language and a traditional language. Do you know the letters?
Q:\AK Русь\ Q:\AK 是漢藏語系漢語族下之\ [Q-Z]:\\AK\s.+[А-Яа-я诶-贼德]\\ |
#27
|
||||
|
||||
Your tool must support unicode for regex! The pattern stays the same and is correct and works fine on regex101 for
Q:\AK Русь\ Q:\AK 是漢藏語系漢語族下之\
__________________
JD-Dev & Server-Admin |
#28
|
|||
|
|||
EmEditor - The text editor supports powerful macros, Unicode!
The Japanese production tool supports 100% Unicode Chinese, Japanese, Korean, more... just need to add a range of letters and it should detect, I just do not know the additional range of the alphabet. I was looking for google, but I found too little information about the alphabet. Edit by Jiaz: you don't have to copy/paste pattern explanation! Last edited by Jiaz; 05.09.2018 at 18:14. |
#29
|
|||
|
|||
[Q-Z]:\\AK\s.+[Ğ-Яа-Ñ诶-贼月-ä¹™]\\
[Window Title] EmEditor [Main Instruction] The regular expression contains an invalid character class name. [Content] [Q-Z]:\\AK\s.+[Ğ-Яа-Ñ诶-贼月-ä¹™]\\ [OK] |
#30
|
||||
|
||||
You don't have to specify them all in bracket!
[Q-Z]:\\AK\s.+\\ works fine with all your examples! if those doesn't work with your editor, then you should find out why not. The pattern is correct as you can validate on regex101
__________________
JD-Dev & Server-Admin |
#31
|
|||
|
|||
It is not easy to determine - what should be the exact pattern for the specific finding of Norwegian, Japanese, Chinese, German and many, many others in the name of the folders.
|
#32
|
||||
|
||||
Why not? You want the path and therefore you don't have to care about language?! The given pattern returns the path despite of used language. Don't understand what your problem is?
__________________
JD-Dev & Server-Admin |
#33
|
||||
|
||||
sigh...
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#34
|
|||
|
|||
For a really complicated name I want to find, I need to take care of the language of the country. Without it or roses, there are many such complicated requests on forums, but in most cases without solving the problem.
If it's so simple and there are solutions on other forums, I would not ask here. |
#35
|
||||
|
||||
Your initial question was about a pattern that extracts the folder. Not about finding only *specific* folders. Now you come up with another question.......
__________________
JD-Dev & Server-Admin |
Thread Tools | |
Display Modes | |
|
|