AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.02.2022, 08:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
How to validate filename with regular expressions
Источник: http://alexvoy.blogspot.com/2022/02/...h-regular.html
==============

I took the idea from this forum https://stackoverflow.com/questions/...-under-windows

We can use regular expressions to check if a given file name is valid.




///
/// Validates a filename for incorrect characters
///
///
///
public boolean checkFileName(Filename _fileName)
{
var bad = System.IO.Path::GetInvalidFileNameChars();
var esc = System.Text.RegularExpressions.Regex::Escape(new System.String(bad));
var exp = new System.Text.RegularExpressions.Regex("[" + esc + "]");

if (exp.IsMatch(_fileName))
{
return checkFailed(strFmt("@SYS339524")); // The specified filename is invalid.
}
return true;
}





Источник: http://alexvoy.blogspot.com/2022/02/...h-regular.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: How to validate and investigate SAF reports for Poland using Notepad++ Blog bot DAX Blogs 0 15.08.2016 12:11
msdyncomm: How Do I: Utilize the New RenderFormat Expressions in Microsoft Dynamics NAV 2013 R2 Blog bot NAV: Blogs 0 18.04.2014 01:13
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
axaptapedia: Regular expressions Blog bot DAX Blogs 0 04.06.2008 02:06
Palle Agermark: Use regular expressions in the Find dialog Blog bot DAX Blogs 1 22.03.2007 21:01

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:04.