- Регистрация
- 06.05.2018
- Сообщения
- 57
- Благодарностей
- 1
- Баллы
- 8
Hello all,
Sorry to ask so many questions here in the forum, you guys are helpful and I really appreciate it.
I'm trying to do mass edits and clean ups in a list with regex, doing it line by line with action blocks is too much and too slow. I'm trying to use this code here: https://zennolab.com/discussion/threads/search-in-list-and-tables-via-c-macro.10733/
...but it's not working. I can sort of read C# and it looks ok I think, but it's not working:
Anyone can make heads or tails of this? Honestly speaking, the list and table action blocks should have more ways to manipulate selected (or all) lines for mass regex edits.
Sorry to ask so many questions here in the forum, you guys are helpful and I really appreciate it.
I'm trying to do mass edits and clean ups in a list with regex, doing it line by line with action blocks is too much and too slow. I'm trying to use this code here: https://zennolab.com/discussion/threads/search-in-list-and-tables-via-c-macro.10733/
...but it's not working. I can sort of read C# and it looks ok I think, but it's not working:
Код:
var parserRegexPattern = project.Variables["(?<=>).*?(?=</p>)"].Value;
var parserRegex = new System.Text.RegularExpressions.Regex(parserRegexPattern);
// get a list for searching
var sourceList = project.Lists["paragraphStripping"];
// get result list
var destList = project.Lists["article"];
// search in each line of the list
lock(SyncObjects.ListSyncer)
{
for(int i=0; i < sourceList.Count; i++)
{
// take one line from the list
var str = sourceList[i];
// check the line on matches by regex, if there are matches we put it to result list
if (parserRegex.IsMatch(str))
{
destList.Add(str);
}
}
}