Filecontent = "Hello this is {{Santa}} from far-far-away coming to your {{country}}.
I like {{world}} with lot of {{Green}}.
You always made me feel {{Happy}} <Testing>"
我想得到结果:
Santa
country
Green
Happy
我尝试使用powershell + regex:(?<=.*{{)\w+?(?=}}.*)
但是只有一个花括号{{xxx}}的实例才能得到我。
谢谢
答案 0 :(得分:2)
PS D:\> $Filecontent = "Hello this is {{Santa}} from far-far-away coming to your {{country}}.
I like {{world}} with lot of {{Green}}.
You always made me feel {{Happy}} <Testing>"
PS D:\> [Regex]::Matches($filecontent, '(?<={{)(.*?)(?=}})') | Select -ExpandProperty Value
Santa
country
world
Green
Happy
正则表达式'(?<={{)(.*?)(?=}})'
测试的位置:左侧{{
,右侧}}
,捕捉中间的所有内容 - 非贪婪(保留在一个括号对内)
答案 1 :(得分:1)
尝试这样的事情:
final Cursor mCursor = getContentResolver().query(
MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, // Uri
new String[]{ // String[] projection (columns)
MediaStore.Audio.Albums.ALBUM_ART,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.NUMBER_OF_SONGS,
MediaStore.Audio.Albums.ALBUM_KEY
},
MediaStore.Audio.Albums._ID + " IN(?,?)", // String selection
new String[]{"16","25"}, // String[] selectionArgs
null, // sortOrder
null // CancellationSignal
);