Xtext - 检查字符串是否为 URL [英] Xtext - Check whether string is URL

查看:40
本文介绍了Xtext - 检查字符串是否为 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Xtext 完全陌生,所以在此先感谢您的帮助.

I'm completely new to Xtext so thanks in advance for your help.

我有以下几点:

terminal PATTERN_SRC : STRING '.png';
Pattern: name='pattern:' value=PATTERN_SRC;

我希望用户像这样编码:

I want the user to code it like this:

pattern: (URL to image ending with .png / .jpg / .gif)

目前我正在检查它,但这不起作用.

Currently I'm checking it like this but this does not work.

有什么好的方法可以解决这个问题吗?提前致谢!

Is there a nice way to solve this? Thanks in advance!

推荐答案

个人评论:

不要使用功能name.这是用于计算资源中元素的唯一名称的保留关键字.

Don't use the feature name. This is a reserved keyword for calculating unique names of an element in a resource.

STRING 是这样的:Sometext".所以你想要的是 "somefile.png"你描述的是"somefile".png您可以只使用 STRING 并实施验证规则以确保您的网址有效.

STRING is like this: "Sometext". So what you want is "somefile.png" What you described is "somefile".png You could just use STRING and implement a validation rule to ensure your URL is valid.

这篇关于Xtext - 检查字符串是否为 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆