开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 194|回复: 10
收起左侧

[易语言] 查找文本段并子文本替换

[复制链接]
结帖率:98% (520/532)
发表于 5 小时前 | 显示全部楼层 |阅读模式   重庆市重庆市
200精币
比如此代码:["workshop-1207269058"]={ configuration_options={ 我是要被修改的 }, enabled=true },
我只知道一个ID数字1207269058,我要替换configuration_options={ 我是要被修改的 }中红色的文本。
问题在于这个红色文本可能是任意文本(但格式相对固定,除了可能存在空格符或换行符多一个少一个的)。我如何来替换他呢

示例完整代码
[JavaScript] 纯文本查看 复制代码
return {
  ["workshop-1207269058"]={ configuration_options={ 我是要被修改的 }, enabled=true },
["workshop-1207269000"]={ configuration_options={ 我是要被修改的,我默认可能为空,也可能为任何参数 }, enabled=true },
  ["workshop-1226903961"]={
    configuration_options={
      bossstrengthen=false,  //参数例子  也就是要被替换的
      bossstrengthen_super=false,//参数例子  也就是要被替换的
      checkcoin=false,//参数例子  也就是要被替换的
      checkstart=true,//参数例子  也就是要被替换的
      trinketedible=false //参数例子  也就是要被替换的
    },
    enabled=true 
  },
  ["workshop-1392778117"]={
    configuration_options={
      AgronExchangeTime=0,
      AgronRechargeTime=0,
      AutoStackedLoot=false,
      BackCubChance=0.5,
      BetterCookBook=true,
      DigestedItemMsg=true,
      DressUp=true,
      FlowerWeaponsChance=0.03,
      FoliageathChance=0.01,
      HiddenUpdateTimes=20,
      Language="chinese",
      LilyBushSpacing=1,
      MouseInfo=1,
      OrchidBushSpacing=2,
      PhoenixBattleDifficulty=2,
      PhoenixRebirthCycle=7200,
      RefractedUpdateTimes=14,
      RevolvedUpdateTimes=10,
      RoseBushSpacing=1,
      ShieldExchangeTime=0,
      ShieldKey=1,
      ShieldRechargeTime=0,
      ShyCoreFruits=1,
      ShyCoreGrowth=1,
      SivFeaDamage=26,
      SivFeaHealthCost=1.5,
      SivFeaThrowedNum=5,
      SivSolToMedal=true,
      SivingRootTex=1,
      TechUnlock="prototyper",
      TissueBerriesChance=0.01,
      TissueCactusChance=0.05,
      TissueLightbulbChance=0.008,
      Title="",
      TransTimeCrop=1,
      TransTimeSpec=1,
      X_growthTime=1,
      X_overripeTime=1,
      X_pestRisk=0.007 
    },
    enabled=true 
  },
  ["workshop-1998081438"]={ configuration_options={ StackMode=true, StackRadius=10 }, enabled=true },
  ["workshop-2189004162"]={
    configuration_options={
      DEBUG_ENABLED=false,
      DEBUG_SHOW_DISABLED=false,
      DEBUG_SHOW_NOTIMPLEMENTED=false,
      DEBUG_SHOW_PREFAB=false,
      alt_only_information=false,
      appeasement_value="undefined",
      armor="undefined",
      attack_range_type="undefined",
      battlesong_range="both",
      blink_range=false,
      boss_indicator=true,
      bottle_indicator=true,
      crash_reporter=false,
      danger_announcements="undefined",
      death_indicator=false,
      display_attack_range="undefined",
      display_batwave_information="undefined",
      display_cawnival="undefined",
      display_compostvalue="undefined",
      display_crafting_lookup_button=true,
      display_fertilizer="undefined",
      display_finiteuses=true,
      display_food="undefined",
      display_gyminfo="undefined",
      display_harvestable=true,
      display_health="undefined",
      display_hunger="undefined",
      display_insight_menu_button=true,
      display_itemmimic_information="undefined",
      display_mob_attack_damage="undefined",
      display_oceanfishing="undefined",
      display_perishable="undefined",
      display_pickable=true,
      display_plant_stressors="undefined",
      display_pollination="undefined",
      display_rabbitking_information="undefined",
      display_rechargeable="undefined",
      display_sanity="undefined",
      display_sanity_interactions="undefined",
      display_sanityaura="undefined",
      display_shadowthrall_information="undefined",
      display_shared_stats="undefined",
      display_shelter_info="undefined",
      display_simplefishing="undefined",
      display_spawner_information="undefined",
      display_tackle_information="undefined",
      display_timers="undefined",
      display_unwrappable="undefined",
      display_upgradeable="undefined",
      display_weather="undefined",
      display_weighable="undefined",
      display_world_events="undefined",
      display_worldmigrator="undefined",
      display_yotb_appraisal="undefined",
      display_yotb_winners="undefined",
      domestication_information="undefined",
      experimental_highlighting=true,
      follower_info="undefined",
      followtext_insight_font_size=28,
      food_effects=true,
      food_memory="undefined",
      food_order="interface",
      food_style="long",
      food_units=true,
      fuel_highlighting=false,
      fuel_highlighting_color="RED",
      fuel_verbosity="undefined",
      growth_verbosity="undefined",
      herd_information="undefined",
      highlighting=true,
      highlighting_color="GREEN",
      highlighting_darkness=true,
      hover_range_indicator=true,
      hoverer_insight_font_size=30,
      hoverer_line_truncation="None",
      hunt_indicator="undefined",
      info_preload="undefined",
      info_style="text",
      insight_font="UIFONT",
      inventorybar_insight_font_size=25,
      item_worth="undefined",
      itemtile_display="percentages",
      klaus_sack_info="undefined",
      klaus_sack_markers="undefined",
      language="automatic",
      lightningrod_range=1,
      miniboss_indicator=true,
      naughtiness_verbosity="undefined",
      nightmareclock_display="undefined",
      notable_indicator=true,
      orchestrina_indicator="undefined",
      pipspook_indicator=true,
      refresh_delay="undefined",
      repair_values="undefined",
      sinkhole_marks=2,
      soil_moisture=2,
      soil_nutrients="undefined",
      soil_nutrients_needs_hat="undefined",
      stewer_chef="undefined",
      suspicious_marble_indicator=false,
      temperature_units="game",
      text_coloring=true,
      time_style="realtime_short",
      tumbleweed_info="undefined",
      weapon_damage="undefined",
      weather_detail="undefined",
      wortox_soul_range=true,
      wx78_scanner_info="undefined",
      ["信息控制"]=0,
      ["指示器"]=0,
      ["杂项"]=0,
      ["格式"]=0,
      ["调试"]=0,
      ["食物相关"]=0 
    },
    enabled=true 
  },
  ["workshop-2287303119"]={
    configuration_options={
      [""]=0,
      Show_naughtiness=true,
      Show_range=true,
      T_crop=true,
      chestB=-1,
      chestG=-1,
      chestR=-1,
      display_hp=1,
      food_estimation=-1,
      food_order=0,
      food_style=0,
      item_info_mod=0,
      lang="auto",
      show_buddle_item=1,
      show_food_units=-1,
      show_fuel=true,
      show_fueled=3,
      show_nutrients=1,
      show_planar_resist=true,
      show_uses=-1 
    },
    enabled=true 
  },
  ["workshop-2771698903"]={
    configuration_options={
      MOD_RESTART_ALLOW_KILL=true,
      MOD_RESTART_ALLOW_RESTART=true,
      MOD_RESTART_ALLOW_RESURRECT=true,
      MOD_RESTART_CD_BONUS=0,
      MOD_RESTART_CD_KILL=1,
      MOD_RESTART_CD_MAX=0,
      MOD_RESTART_CD_RESTART=2,
      MOD_RESTART_CD_RESURRECT=1,
      MOD_RESTART_FORCE_DROP_MODE=0,
      MOD_RESTART_IGNORING_ADMIN=true,
      MOD_RESTART_MAP_SAVE=1,
      MOD_RESTART_RESURRECT_HEALTH=0,
      MOD_RESTART_TRIGGER_MODE=1,
      MOD_RESTART_WELCOME_TIPS=true,
      MOD_RESTART_WELCOME_TIPS_TIME=10 
    },
    enabled=true 
  },
  ["workshop-2831803551"]={ configuration_options={  }, enabled=true },
  ["workshop-2928810007"]={
    configuration_options={
      zx_beebox=true,
      zx_granary_freshrate=0.2,
      zx_items_language="ch",
      zx_meatrack=true,
      zxdiffculty=2,
      zxfarmarea=1,
      zxfarmdroprate=1,
      zxfarmenable=true,
      zxfarmmaxlv=3,
      zxfishenable=true,
      zxlightradius=1,
      ["其他物品"]=false,
      ["农场设置"]=false,
      ["基础设置"]=false,
      ["永亮灯设置"]=false,
      ["渔场设置"]=false,
      ["箱子设置"]=false 
    },
    enabled=true 
  },
  ["workshop-3044756151"]={
    configuration_options={
      ANNOUNCE_MODE=true,
      CLEANDAYS=15,
      axe=3,
      bee=10,
      beefalo=50,
      birdtrap=10,
      blueprint=3,
      bugnet=3,
      burntground=5,
      clean=true,
      compass=3,
      cutgrass=50,
      deer=10,
      driftwood_log=130,
      earmuffshat=3,
      evergreen_sparse=150,
      feather=2,
      festival=2,
      firehound=10,
      fishingrod=3,
      flies=10,
      flint=50,
      frog=20,
      glommerfuel=10,
      guano=1,
      hammer=3,
      heatrock=10,
      hound=10,
      houndstooth=2,
      lang=true,
      log=50,
      manrabbit_tail=20,
      marsh_tree=100,
      mosquitosack=10,
      nitre=50,
      oceanfishingrod=3,
      pickaxe=3,
      pinecone=50,
      pitchfork=3,
      pocket_scale=3,
      poop=5,
      razor=3,
      rock_petrified_tree=150,
      rocks=50,
      rocky=20,
      rottenegg=2,
      seeds=3,
      shovel=3,
      silk=10,
      skeleton_player=20,
      sketch=1,
      slurtle=5,
      slurtleslime=2,
      spear=3,
      spider=10,
      spiderden=40,
      spidergland=10,
      spoiled_fish=2,
      spoiled_food=2,
      stack=true,
      stack_fireflies=true,
      stack_scanning_range=10,
      stinger=2,
      tacklesketch=1,
      test_mode=false,
      torch=3,
      trade=true,
      trap=30,
      twiggytree=150,
      twigs=50,
      winterhat=3 
    },
    enabled=true 
  },
  ["workshop-3353852416"]={
    configuration_options={
      CH_LANG=true,
      CountdownEnable=false,
      HomesignEnable=false,
      HungerCost=1,
      LightEnable=true,
      ResurrectEnable=true,
      SanityCost=1,
      TextEnable=false 
    },
    enabled=true 
  },
  ["workshop-378160973"]={
    configuration_options={
      ENABLEPINGS=true,
      FIREOPTIONS=2,
      OVERRIDEMODE=false,
      SHAREMINIMAPPROGRESS=true,
      SHOWFIREICONS=true,
      SHOWPLAYERICONS=true,
      SHOWPLAYERSOPTIONS=2 
    },
    enabled=true 
  },
  ["workshop-661253977"]={
    configuration_options={ amudiao=true, baodiao=1, kong=0, nillots=0, rendiao=2, zbdiao=true },
    enabled=true 
  },
  ["workshop-831523966"]={ configuration_options={ soul_stack=20, stack_size=999 }, enabled=true } 


002.jpg QQ截图20250701111431.jpg


回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳

结帖率:100% (1/1)

签到天数: 1 天

发表于 5 小时前 | 显示全部楼层   河南省郑州市
  
子程序名返回值类型公开备 注
正则匹配  
变量名类 型静态数组备 注
表达式正则表达式类 
i整数型 
表达式.创建 (" (1226903961[\w\W]*?configuration_options={) ([\w\W]*?) (})", #常量1, 假, 假, 真, )
调试输出 (表达式.替换 ("$1来了老弟$3"))
回复

使用道具 举报

结帖率:98% (520/532)

签到天数: 1 天

 楼主| 发表于 4 小时前 | 显示全部楼层   重庆市重庆市
afu45 发表于 2025-7-1 11:32
[e=0].版本 2

.子程序 正则匹配

这种方法,如果多个{}参数内容为空或者一样,直接子文本替换会误吧其他也替换了,有其他办法嘛

点评

测试都没测试 就说不行   河南省郑州市  发表于 4 小时前
比如呢?   河南省郑州市  发表于 4 小时前
回复

使用道具 举报

结帖率:100% (106/106)

签到天数: 1 天

发表于 4 小时前 | 显示全部楼层   浙江省温州市
1.png 2.png


222.e (933.72 KB, 下载次数: 4)
回复

使用道具 举报

结帖率:100% (106/106)

签到天数: 1 天

发表于 3 小时前 | 显示全部楼层   浙江省温州市
改个新的 111.png 222.png


222.e (937.67 KB, 下载次数: 1)

点评

快点最佳 不然给你嘴巴子!{:6_415:}{:6_415:}   浙江省温州市  发表于 3 小时前
回复

使用道具 举报

结帖率:94% (80/85)

签到天数: 1 天

发表于 3 小时前 | 显示全部楼层   湖南省长沙市

哈哈哈哈哈哈哈 都给人家嘴巴了 在这里写了俩个 快帮我弄一下 我不睡了 给你秒最佳
回复

使用道具 举报

签到天数: 1 天

发表于 2 小时前 | 显示全部楼层   湖南省长沙市
复制到TXT文件里面,ctrl+H替换不知道行不行。
回复

使用道具 举报

结帖率:100% (1/1)

签到天数: 1 天

发表于 2 小时前 | 显示全部楼层   江西省南昌市
这个足够你用了

Desktop.zip

286.27 KB, 下载次数: 1

QQ截图20250701141052.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报QQ: 793400750,邮箱:wp@125.la
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表