Hi Pablo,

is the following what you need?

context("\\\\1. " .. url:match ".+/")
context("\\\\2a. " .. url:match "[^/]+/.+[.]") -- path and name with period
--context("\\\\2b. " .. url:match "[^/]+[^.]+$") -- name with period and 
extension
context("\\\\2c. " .. (url:match "[^/]+[^.]+$") :match ".+[.]")  -- name with 
period

Best wishes,

Tomáš

Fri, Aug 27, 2021 ve 08:53:52PM +0200 Pablo Rodriguez via ntg-context napsal(a):
# Dear list,
# 
# I have the following sample:
# 
#   \starttext
#   \startluacode
#   url = "../a/b/cb/ce.b/ca.b/c/dabc.pdf"
# 
#   context(url)
# 
#   context("\\\\0 ok. " .. url:match "^(.*).pdf$") -- name and path
# 
#   context("\\\\1. " .. url:match "^(.*).+$") -- path
# 
#   context("\\\\2. " .. url:match"[^/]+[.$]") -- name
# 
#   context("\\\\3 ok. " .. url:match "[^.]+$") -- extension
#   \stopluacode
#   \stoptext
# 
# How can I get that match for #1 ends in the last slash (including it
# "../a/b/cb/ce.b/ca.b/c/") and match for #2 ends in the last period
# (excluding it, "dabc")?
# 
# Many thanks for your help,
# 
# Pablo
# --
# http://www.ousia.tk
# 
___________________________________________________________________________________
# If your question is of interest to others as well, please add an entry to the 
Wiki!
# 
# maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
# webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
# archive  : https://bitbucket.org/phg/context-mirror/commits/
# wiki     : http://contextgarden.net
# 
___________________________________________________________________________________

                                         Tomáš Hála
--------------------------------------------------------------------
Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno,  tel. +420 545 13 22 28
--------------------------------------------------------------------
http://akela.mendelu.cz/~thala
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to