I am attempting to perform some htaccess redirects for cleaner URL's, however i unsuccessful to complete.

Here's my intend:

/kitap/blah     => kitap.php?a=blah
/kitap/blah-123 => kitap.php?a=blah&b=123

This really is my current code.

RewriteRule ^(kitap|yazar)/?([^/\.]+)?(-([0-9]+))?/?$ $1.php?a=$2&b=$3 [QSA,L,NC]

Presently it creating this:

/kitap/blah     => kitap.php?a=blah
/kitap/blah-123 => kitap.php?a=blah-123

The term "blah" may include Unicode figures, like ç,ö,ğ,ş etc. (What this means is [a-z0-9_] won't operate in my situation)

How do i accomplish my intended result? I attempted something more important but no success. Thanks.

RewriteRule ^(kitap|yazar)/?([^/\.-]+)?(-(\d+))?/?$ $1.php?a=$2&b=$4 [QSA,L,NC]

or

RewriteRule ^(kitap|yazar)/?(\p{L}+)?(-(\d+))?/?$ $1.php?a=$2&b=$4 [QSA,L,NC]

$4, not $3 unless of course you want to make use of the dash -, if you are using $3, $_GET['b'] is going to be comparable to -123. Every set of parantheses counts, to ensure that $3 is -123, whereas $4 is 123.

\p means a unicode character, and {L} means instructions. You can observe available modifiers at PHP PCRE regex - Unicode character properties. For their services, your version of PHP should be put together with --enable-unicode-properties.

I wound up having a "hybrid" solution from Alin and battal's comments.

RewriteRule ^(kitap|yazar)/?([^/\.-]+)?(-([0-9]+))?/?$ $1.php?a=$2&b=$4 [QSA,L,NC]

And delay pills work. Thanks!