Problem z RegExp

English main discussion
  • Author
  • Message
Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Problem z RegExp

Post by sexy96 »

2+5-7=0

To jest OK.
[+][0-9]
[+]\d

a to nie działa
"Błąd składni (2)"

[-][0-9]
[-]\d

Jak powinno być to poprawnie napisane?

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

sexy96
1)
-[0-9]
-\d

2)
[\-][0-9]
[\-]\d

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Post by sexy96 »

Thanks. This is it.

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Problem z RegExp.

Post by sexy96 »

Chcę poszukać wyrazy, w których druga litera jest: b

W tym przykładzie jest obok

"dwóch jedynek, obok siebie"

Ten zapis nie działa: (\b .b)
gdy przed nim są w tekście znaki :,.';"

Jak powinien wyglądać poprawny zapis?
W Google'u nie mogę tego znaleźć.

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

sexy96
1. English?
2. (\b .b) --> (\b.b)

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Post by sexy96 »

Thanks, now is fine.

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

RegExp problem.

Post by sexy96 »

I want to find words in which the second letter is "c"

Tester:
Image
here False
Last edited by sexy96 on Sun Feb 05, 2017 10:42 am, edited 1 time in total.

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

Code: Select all

\b\wc
\b-word boundary
\w-word character

PS: looks like regex 101 fails to recognize "ę"as single char (it is seen as e + diacritic codepoint so it fail to recognize it as non-delimiter). Well, you should find out what is official position of regex implementors/standards.

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Post by sexy96 »

Now is good. Thanks

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

RegExp problem.

Post by sexy96 »

linia$(1) = "[Buttonbar]": linia$(2) = TextLinii$(2)
ReDim Preserve TextLinii$(nn%)
Buttoncount = Right(TextLinii$, Len(TextLinii$ - 2))
2+3
Buttoncount = Right(TextLinii$, Len(TextLinii$ - 2))

Kod: .*= Right\(.*Len\(.*

https://regex101.com
Image


AkelPad:
Image

Why the difference?
Last edited by sexy96 on Sun Feb 05, 2017 10:43 am, edited 1 time in total.

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

sexy96
Symbol "dot" (.) in AkelPad can be interpreted in two ways: "dot '.' matches any single character (default)" or "dot '.' matches any single character, except newline character".
See "AkelHelp-Eng.htm" --> "Regular expression syntax" --> (?options):
(?s) dot '.' matches any single character (default).
(?-s) dot '.' matches any single character, except newline character.
You can use that option "directly" in expression or you can check it in form "Find" (look at the small triangle to the right of option "[ ] Regular expressions ▼")

The second way is to use script "FindReplaceEx.js". It is most similar to "regex101.com"

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Post by sexy96 »

I switched off: .matches \ n
Now is OK. Thanks

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

RegExp problem.

Post by sexy96 »

I would look "only" the number contained in parentheses
without marking the brackets.
I know it does not matter, but if it can be done?

Image
Last edited by sexy96 on Sun Feb 05, 2017 10:44 am, edited 1 time in total.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

sexy96

Use TextMarker.js script with regular expression:

Code: Select all

(?<=\()\d+(?=\))

Offline
Posts: 282
Joined: Thu Sep 10, 2015 9:53 am
Location: Deutschland

Post by sexy96 »

Dzięki.
Post Reply