User Tools

Site Tools


creating_cases_using_pattern_search

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
creating_cases_using_pattern_search [2024/02/29 16:31]
chris
creating_cases_using_pattern_search [2024/02/29 18:04] (current)
chris
Line 9: Line 9:
 Then click the "​Create Multiple"​ button. Then click the "​Create Multiple"​ button.
  
-{{ :​add_multiple_cases_1.png?​800 |}}+{{ :​add_multiple_cases_1.png?​600 |}}
  
 ==== Running a pattern search ===== ==== Running a pattern search =====
Line 20: Line 20:
   - When you're happy with the results, click Create. If you want to add/remove files you can edit the case after creation.   - When you're happy with the results, click Create. If you want to add/remove files you can edit the case after creation.
  
-{{ :pattern search 1.png?800 |}}+{{ :pattern search 1.png?600 |}}
  
-==== Pattern Search Behaviour and how to use '​Regular Expression'​ in a Search ====+===== Pattern Search Behaviour and how to use '​Regular Expression'​ in a Search ​=====
  
 Regular expressions,​ often abbreviated as regex or regexp, are powerful tools for pattern matching and text manipulation. They provide a concise and flexible way to describe, search, and manipulate strings. Regular expressions,​ often abbreviated as regex or regexp, are powerful tools for pattern matching and text manipulation. They provide a concise and flexible way to describe, search, and manipulate strings.
  
 +==== Adding Every File as it's Own Case ====
  
 +.* 
  
 +That's all you need. The '​.'​ matches any character except for a new line, and the '​*'​ says the preceeding character can be matched 0 or more times.\\
 +In the screenshot below, you can see this search makes a new case for every WSI file in the directory.
 +
 +{{ :pattern search 3.png?600 |}}
 +
 +Here are some examples of how .* behaves in a regex pattern:
 +
 +abc.*def: This pattern would match strings that start with "​abc"​ and are followed by any sequence of characters, eventually ending with "​def"​. For example, it would match "​abc123def"​ or "​abcxyzdef"​.
 +
 +.*\d+.*: This pattern would match strings that contain one or more digits anywhere in the string. The .* before and after \d+ allows for any characters before and after the digit(s).
 +
 +In the screenshot below you can see that '​.*-'​ matches only files that have a '​-'​ in their name
 +
 +{{ :pattern search 5.png?600 |}}
 +
 +==== Adding Similarly Named Files into Cases ====
 +
 +What about if you have file(s) named in a similar way?
 +
 +We can use some simple commands to sort these into cases.
 +
 +Here you can see that typing '​.'​ matches all files starting with the same character into a Case.
 +
 +{{ :pattern search 4.png?600 |}}
 +
 +
 +If you have files with different names, but each case shares the first 4 letters or numbers, you can type '​....'​ to group them together.
 +
 +Another way to search and group together files into Cases is using [].\\
 +Any search terms you put within the [] will be searched for.\\
 +In the example below, we use ^[\d\w]* to find the starting pattern of each filename until it is interrupted by a special character e.g. '​('​ or '​.'​
 +
 +{{ :pattern search 6.png?600 |}}
 +
 +You can also chain several of these blocks together, for example:\\
 +^[\d\w]+-[\d\w]+-[\d\w] would find all files with three strings of alphanumeric characters, each separated by a '​-'​
 +
 +==== Finding Many Files for a Single Case ====
 +
 +You can use pattern search like a regular search engine to find '​files'​ in your selected folder\\ ​
 Some examples include: Some examples include:
  
Line 33: Line 75:
 Using ^CF to match any string starting with '​CF'​ \\ Using ^CF to match any string starting with '​CF'​ \\
 Using ? to indicate subexpressions in your pattern, e.g. "​fish(er)?"​ matches "​fish"​ or "​fisher"​. Using ? to indicate subexpressions in your pattern, e.g. "​fish(er)?"​ matches "​fish"​ or "​fisher"​.
- 
-You can learn more about regex with online guides including: 
-https://​www.microfocus.com/​documentation/​relativity/​relativity1216/​reldbdsn/​GUID-7C2DF185-41A1-4448-81E7-3252AA8DEBB3.html 
  
 In the screenshot below you can see the $ regex [1] has been used to select only .svs files across many subfolders [2] In the screenshot below you can see the $ regex [1] has been used to select only .svs files across many subfolders [2]
  
-{{ :pattern search 2.png?800 |}}+{{ :pattern search 2.png?600 |}}
  
-==== Regular Expression Syntax ====+==== Full Explanation of Regular Expression Syntax ====
  
 Here are some key concepts and syntax: Here are some key concepts and syntax:
  
 1. Literal Characters:​\\ 1. Literal Characters:​\\
 +
 Most characters in a regular expression match themselves literally. \\ Most characters in a regular expression match themselves literally. \\
 For example, the regular expression abc will match the string "​abc"​ in the input. For example, the regular expression abc will match the string "​abc"​ in the input.
creating_cases_using_pattern_search.1709213463.txt.gz ยท Last modified: 2024/02/29 16:31 by chris