Reputation: 57
So I have a code like this
TitleManager:AddSubTitleMissionInfo_LUA({
m_iID = 10,
m_wstrDescription = "Professional Killer",
m_eClearType = TITLE_MISSION_CLEAR_TYPE.TMCT_MOB_KILL_COUNT,
m_bAutomaticDescription = True,
m_ClearCondition = {
m_eMobID = {68},
m_iMobKillCount = {1}
}
})
TitleManager:AddSubTitleMissionInfo_LUA({
m_iID = 20,
m_wstrDescription = "Sneaky Assassin",
m_eClearType = TITLE_MISSION_CLEAR_TYPE.TMCT_MOB_KILL_COUNT,
m_bAutomaticDescription = True,
m_ClearCondition = {
m_eMobID = {69},
m_iMobKillCount = {1}
}
})
TitleManager:AddSubTitleMissionInfo_LUA({
m_iID = 20,
m_wstrDescription = "Merciless Thug",
m_eClearType = TITLE_MISSION_CLEAR_TYPE.TMCT_MOB_KILL_COUNT,
m_bAutomaticDescription = True,
m_ClearCondition = {
m_eMobID = {70,71},
m_iMobKillCount = {1,1}
}
})
There are like a hundred of those, all different. How do I replace everything in between the curly brackets.
m_ClearCondition = {
}
to
m_ClearCondition = {
m_eMobID = {50},
m_iMobKillCount = {1}
}
I really hope someone could answer my question, I would be really grateful.
Upvotes: 2
Views: 1283
Reputation: 15000
There are several unclear things about your sample text from your post. But this expression assumes:
m_clearcondition
value will have no nested brackets more then one level deep.Regex:
^(\s+m_ClearCondition\s*=\s*\{)(?:\{[^}]*\}|[^}])*(\})
Replace with:
$1\n m_eMobID = {50},\n m_iMobKillCount = {1}\n $2
Live demo of the regex: http://regexr.com?35n0l
In this example I'm using Notepad++ 6.4.2. There where known problems using regex in Notepad version 5 and lower.
Upvotes: 1
Reputation: 569
Regex is your friend. Ctrl-H (Find/replace) and enable regular expressions (bottom left of dialog).
\{\s*\}$
replace with:
{\nwhatever you want\n}\n
Regex Match Explanation:
Upvotes: 0