S
S
serj372019-09-11 08:24:59
Regular Expressions
serj37, 2019-09-11 08:24:59

How to remove characters at the beginning and end of a string with a regex?

I can’t find a solution to 2 questions in any way:
1. Delete characters at the beginning and end of the line:
it was -

#слово#
#второе слово#

should be -
слово
второе слово

2. Delete lines starting with a set of characters - $1$ or $HEX[ (it's better to delete one of the sets at once)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-09-11
@serj37

One option like this:
Several options like this, where the options are grouped (?:1|2|3|4|5):
The result will be like a cut, i.e. a substring.

Your examples:
https://regex101.com/r/q5HvUp/2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question