Javascript:使用RegEx读取android清单文件中的包

问题描述 投票:1回答:1

清单文件通常是android apk:

<?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.myapp"
   android:versionCode="1"
   android:versionName="1.0" >

我需要阅读包引号之间的内容(例如"com.example.myapp"),并将其存储在变量中。我正在使用文件阅读器来读取文件的内容,但是我的RegEx很弱,可以帮帮我吗?

javascript
1个回答
1
投票

如果应该将文件存储在变量filecontent中,则可以尝试以下正则表达式-

© www.soinside.com 2019 - 2024. All rights reserved.