Regex to format numbers in italic [closed] - regex

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 26 days ago.
Improve this question
I would like to format many chains of a text in italic. They are of the type 'Arbre 10523' I can capture them with
(Arbre)\b [0-9]{3,5}
but I do not know how to transform all these words in italic, if I replace the chain is just erased.
Thanks

Are you talking about LibreOffice Writer? If so, you can use the Find & Replace function from the ribbon (or Ctrl+H). Make sure to select 'Match Case' for case-sensitive matching, 'Regular Expresions' and select 'Italic' under Format:
I used the pattern:
\b(Arbre \d{3,5}(?!\d))
\b - Word-boundary to assert position is not preceded with other word-characters;
( - Open a capture group for backreference in the replace field;
Arbre \d{3,5} - Match 'Arbre ' followed by 3-5 digits;
(?!\d) - Negative lookahead to assert position is not followed by more digits;
) - Close capture group.
Now refer to $1 in your replace field. Then click replace all:

Related

removing specific thousand separator in specific column in notepad++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have set of numbers format like 1.8789 and would like the output to become 1878.9
These number is inside specific column and have million lines to be update.
I didn't find any similar to solve this.
Below is the highlight screenshot.
data set
For the exact style/precision of number you gave, you may try the following find and replace, in regex mode:
Find: (\d+)\.(\d{3})(\d+)
Replace: $1$2.$3
Demo
Try this code ...
Find: (?<=1)\.(\d{3})
Replace with: $1.
As far as I understand, you want to change only the last column. Here is a way to go:
Ctrl+H
Find what: \.(\d{3})(?=\d*$)
Replace with: $1.
CHECK Wrap around
CHECK Regular expression
Replace all
Explanation:
\. # a dot
(\d{3}) # group 1, 3 digits
(?= # positive lookahead, make sure we have after:
\d* # 0 or more digits
$ # end of line
) # end lookahead
Replacement:
$1 # content of group 1, 3 digits
. # a dot
Screenshot (before):
Screenshot (after):

Regex for italian tags [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm working on a regex to take #users
In italian, sometime there is something like l'#Orazio.
I can't find the right way to take this.
I'm using this line /(?<=^|\s)(#(\S+))/
this is my online tester
https://regex101.com/r/s5BTm0/12
as you can see I have an issue with the case 4
Any tips?
You may use
(?<!\S)(?:\w+['’])?#(\S+)
(?<!\w)(?:\w+['’])?#(\S+)
See the regex demo
Details
(?<!\S) - whitespace or start of string must appear immediately to the left of the current location
(?<!\w) - a location the is not immediately preceded with a word char
(?:\w+['’])? - an optinal sequence of 1+ word chars and then ' or ’
# - a # char
(\S+) - Capturing group 1: one or more non-whitespace chars.
Use an optional group:
(?<=^|\s)(?:\w?'?)(#(\S+))
https://regex101.com/r/s5BTm0/5
For more than 1 letter in front, use:
(?<=^|\s)(?:(\w*')?)(#(\S+))
https://regex101.com/r/s5BTm0/8
And to match all your updated cases:
https://regex101.com/r/s5BTm0/10
For different types of apostrophes:
(?<=^|\s)(?:(\w*['´])?)(#(\S+))
https://regex101.com/r/s5BTm0/13

Using captured groups in Regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to match a string where there are 5 characters where first four characters are A-Z and 5th is a digit. Also the first and the fourth character should be same.
I have a regex: [A-Z]{4}\d
However this wont check if 1st and 4th character are same. Please help
Regex: ^([A-Z])[A-Z]{2}\1\d$
1. ^ start of string.
2. ([A-Z]) capture first character.
3. [A-Z]{2} match next two character which can be in A-Z
4. \1 using captured group which contains first character of string.
5. \d a digit which can be 0-9
6. $ for end of string.
Regex demo

Which RegEx expression to find in notepad++? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have in Notepad++ plenty of datetime texts like:
'20160310 17:59:00'
And I want to add '-' character to separate numbers in the date like
'2016-03-10 17:59:00'
How I would be a RegEx expression to do that?
The following regex expression:
('\d{4})(\d{2})(\d{2} \d{2}:\d{2}:\d{2}')
Combined with the following replace expression:
$1-$2-$3
will achieve what you want.
Explanation:
('\d{4}) capture group 1: an apostrophe followed by 4 digits
(\d{2}) capture group 2: 2 digits
(\d{2} \d{2}:\d{2}:\d{2}') capture group 3: 2 digits, a space, 2 digits, a colon, 2 digits, a colon and 2 digits, followed by an apostrophe
$1-$2-$3 - capture group 1, followed by a -, followed by capture group 2, followed by a -, followed by capture group 3

regex masking patterns [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have these inputs:
DFDBDFDFDF21R123
DFDBDFDFDF34R123
I want to match these inputs, except positions 9 and 10, like below:
DFDBDFDFxxR123
DFDBDFDFxxR123
So, to be clear: match 1-8, exclude 9-10, match 11-16.
To expand upon the answer from https://stackoverflow.com/users/557597/sln of
(.{8})..(.+)
The 'thing' you are missing from your understanding of Regex is 'grouping'
(SOME MATCHING SUB-STRING A)(SOME MATCHING SUB-STRING B)
If you use regex like this, you can do lots of nice things including 'pull out' parts of a line and then re-arrange them. But it also helps you group 'parts' that you want to search for.
so his
.{8}
matches '.' which is 'any single character' and then {8} means 'match any single character 8 times.
(.{8})
means 'group the first 8 characters' for use.
..
means 'match any two characters'
.+
means 'match 1 or more of 'any character'
(.+)
means "group that 1 or more of 'any character' for later use"
Therefore...
When you put them all together you get
(.{8})..(.+)
Which means 'match the first 8 characters (any 8 characters) as group 1' then 'any two characters' then '1 or more characters as group 2'
This would allow you to (depending on your regex client/etc.) is use $1 and $2 to print out, use or ...whatever... the values of group 1 and/or group 2.
Hope this helps.